n = input()[::-1]

f = 1
k = ""
for el in n:
    # if f == 1 and el == '0':
    #     continue
    # if f == 1 and not (el == '0'):
    #     f = 0
    if el == '2':
        k += "5"
    elif el == '5':
        k += "2"
    else:
        k += el

print(int(k))
