main :: IO () main = putStr . solve =<< getLine solve :: String -> String solve n = unwords [a, b] where a = map (\c -> if c == '7' then '1' else '0') $ n b = show $ read n - read a