k = int(input())
a = str(k)
ans = ""
count = 0
for i in range(1,len(a)+1):
    if a[-1] != "0":
        count = 1
    if a[-i] == '5':
        ans += '2'
    elif a[-i] == '2':
        ans += '5'
    elif a[-i] == '0':
        if i != 1 and i != len(a) and count != 0:
            ans += a[-i]
    else:
        ans += a[-i]
print(ans)
