def swap(x, y):
    a[x], a[y] = a[y], a[x]

s = input()
a = []

for i in s:
    a.append(int(i))

for i in range(len(s)):
    a[i] = (a[i] + 3) % 9

swap(0, 2)
swap(1, 3)

for i in a:
    print(i, end = '')