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