n = str(input())
reverse = n[::-1]

reverse = reverse.replace("2",  "X")
reverse = reverse.replace("5",  "2")
reverse = reverse.replace("X",  "5")
if reverse[0] == "0":
    print(reverse[1:])
else:
    print(reverse)
