a = input()
s = []
if 1 <= int(a) <= 10**18:
    for i in a:
        if int(i) == 2:
            s.append(5)
        elif int(i) == 5:
            s.append(2)
        elif int(i) == 0:
            continue
        else:
            s.append(int(i))
else:
    print('Error')
print(*s[::-1], sep = '' )
