k = input()
k = k[::-1]
t = True
an = ""
for i in k:
    if t and i == '0':
        continue
    if t:
        t = False
    if i == '2':
        an += '5'
    elif i == '5':
        an += '2'
    else:
        an += i
if an:
    print(an)
else:
    print(0)
