n=input()[::-1]
mas=[]
fir=0
i=0
while i<len(n):
    if fir==0 and n[i]=='0':
        i+=1
        continue
    elif fir==0 and n[i]!='0':
        fir=1
    if n[i]=='2':
        mas.append('5')
    elif n[i]=='5':
        mas.append('2')
    else:
        mas.append(n[i])
    i+=1

print(*mas,sep='')