floor = input()
floor_array = []
floor_length = len(floor)
final = ''
for i in range(0, floor_length):
    floor_array.append(floor[i])
while floor_array[-1] == "0":
    floor_array.pop()

for i in range(0, len(floor_array)):
    if floor_array[i] == "2":
        floor_array[i] = "5"
    elif floor_array[i] == "5":
        floor_array[i] = "2"
floor_array = floor_array[::-1]
for j in range(0, len(floor_array)):
    final = final + floor_array[j]
print(final)