n = input()
m = len(n)
k = n[::-1]
for i in range(m):
    if k[i] != '0':
        b = i
        break
p = k[b::]
for i in range(m - b):
    if p[i] == "2":
        print(5,end="")
    elif p[i] == "5":
        print(2,end="")
    else:
        print(p[i], end="")
