from collections import defaultdict

MOD = 1000000007
INF = 1e9

def solve():
    s = input()
    s = s[::-1]
    answer = ""
    for i in range(len(s)):
        if i == 0 and s[i] == '0':
            continue
        if s[i] == '5':
            answer += '2'
        elif s[i] == '2':
            answer += '5'
        else:
            answer += s[i]
    print(answer)

def main():
    t = 1
    while t > 0:
        solve()
        t -= 1

if __name__ == "__main__":
    main()
