program AtCoder_Beginner_Contest_999
  implicit none
  character(3) :: n
  integer :: i
  read(*,*) n
  do i = 1, 3
    n(i:i) = achar(106-ichar(n(i:i)))
  end do
  write(*,'(a)') n
end program AtCoder_Beginner_Contest_999