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