n = input()
n = reversed(n)
n = ''.join(n)
n = list(n)
for i in range(len(n)):
    if n[i] == "5":
        n[i] = "2"
    elif n[i] == "2":
        n[i] = "5"

if n[0] == "0":
    n.pop(0)
    n = ''.join(n)
    print(n)
else:
    n = ''.join(n)
    print(n)
