def reversed1(variable):
    res=''
    for i in range(len(variable)-1,-1,-1):
        res+=variable[i]
    return res
 
k = reversed1(input())

for i in range(len(k)):
    k = k.replace("2", "#")
    k = k.replace("5", "2")
    k = k.replace("#", "5")
 
if k.startswith("0"):
    k = k[1:]
     
print(k)
