k = list(input())
mirrored_floor = []
for i in k[::-1]:
    if i == '2':
        mirrored_floor += '5'
    elif i == '5':
        mirrored_floor += '2'
    else:
        mirrored_floor.append(i)
for i in range(len(mirrored_floor)):
    if mirrored_floor[0] == '0':
        del mirrored_floor[0]
    else:
        break
print(*mirrored_floor, sep = '')