a = input()
s = []
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))
print(*s[::-1], sep = '' )
