a = int(input())
a = str(a)
li=[]
string = ''
if int(a) <= 10e18 and int(a)>=1: 
    for i in a:
        if i == '5':
            li.append('2')
        elif i =='2':
            li.append('5')
        else:
            li.append(i)
    li.reverse()
    if li[0] == '0':
        li.remove('0')
            


    for el in li:
        string += el
    print(string)
else:
    print('error')

