n = input()
res = ""
for i in n:
    match (i):
        case "2":
            res += "5"
        case "5":
            res += "2"
        case _:
            res += i
 

res = res[::-1]
if res[0] == '0':
    print(res[1::])
else:
    print(res)