program sunuke

implicit none

integer::    n
integer::    x,y,z

read(*,*) n
x=int(n/100)
n=n-100*x
y=int(n/10)
z=n-10*y


if(x==1) then
  x=9
else if(x==9) then
  x=1
endif
if(y==1) then
  y=9
else if(y==9) then
  y=1
endif
if(z==1) then
  z=9
else if(z==9) then
  z=1
endif

n=100*x+10*y+z

write(*,*) n

end program sunuke
