solve :: String -> String
solve [] = ""
solve (x:xs)
  | x == '1' = '9' : solve xs
  | x == '9' = '1' : solve xs
  | otherwise = x : solve xs

main :: IO ()
main = do
  n <- getLine
  putStrLn $ solve n