n = input()
res = ""
for char in n[::-1]:
    if char=="5":
        res+="2"
    elif char=="2":
        res+="5"
    elif char=="2":
        res+="5"
    else:
        res += char

print(str(int(res)))

    

