import Control.Arrow main = do n <- readLn let ds = map (`mod` 10) . takeWhile (>0) . iterate (`div` 10) $ n f x = if x == 7 then (3, 4) else (x, 0) sum = foldr1 (\x y -> x + y * 10) (a, b) = sum *** sum $ unzip $ map f ds putStrLn $ show a ++ " " ++ show b