import sys

def solve():
    x = input()
    x = x.strip('0')[::-1]
    for s in x:
        if s == "2":
            print("5", end="")
        elif s == "5":
            print("2", end="")
        else:
            print(s, end="")

def main():
    solve()

main()