k = input()

result = ""
for num in k[::-1]:
    if num == "5":
        result += "2"
    elif num == "2":
        result += "5"
    elif num == "0" and len(result) == 0:
        continue
    else:
        result += num

print(result)
