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

if n[0] == "0":
    n = n[1:]
    print(n)
else:
    print(n)
