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

floor = reversed1(input())

floor = floor.replace("2", "#")
floor = floor.replace("5", "2")
floor = floor.replace("#", "5")

if floor.startswith("0"):
    floor = floor[1:]
    
print(floor)
