import Control.Applicative

main :: IO ()
main = solve <$> getLine >>= putStrLn

solve :: String -> String
solve = map f
  where
    f c
      | c == '1' = '9'
      | c == '9' = '1'
      | otherwise = c
