a = int(input())
c = []
s = 0
while a != 0:
  if(a%10 == 5):
    c.append(2)
  elif(a%10 == 2):
    c.append(5)
  else:
    c.append(a%10)
  a = a//10
if(c[0] == 0):
  c.pop(0)
elif(c[-1] == 0):
  c.pop(-1)
for i in range(len(c)):
  s = s*10 + c[i]
print(s)