
n = input()
m = len(n)
k = n[::-1]
for i in range(m):
    if k[i] == "2":
        print(5,end="")
    elif k[i] == "5":
        print(2,end="")
    elif k[i] == "0" and i == 0:
        continue

    else:
        print(k[i], end="")









