n = str(input())
n = n[::-1]
f = True
while f:
    if n[0] == '0':
        n = n[1:]
    else:
        f = False

b = ''
for i in range(len(n)):
    if  n[i] == '2':
        b+='5'
    elif n[i] == '5':
        b+='2'
    else:
        b+=n[i]
print(b)
