import Control.Applicative import Control.Monad main :: IO () main = do ns <- solve 0 0 <$> getLine putStrLn $ show (fst ns) ++ " " ++ show (snd ns) solve :: Int -> Int ->String -> (Int, Int) solve x y [] = (x, y) solve x y [c] | c=='7' = (10*x+3, 10*y+4) | otherwise = (10*x+read [c], 10*y) solve x y (c:cs) = solve a b cs where (a, b) = (10*x+u, 10*y+v) (u, v) = solve 0 0 [c]