import Control.Monad

main = do
    n <- read <$> getLine
    putStrLn $ solve n

solve :: Int -> String
solve n = convert (n `div` 100) : convert (n `div` 10) : convert n : []
  where
    convert n | n `mod` 10 == 1 = '9'
              | otherwise       = '1'
