program sunuke

implicit none

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

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

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

n=100*x+10*y+z

write(*,*) n

end program sunuke
