solve n = show a ++ " " ++ show b where a = read n - b b = read [if c == '7' then '1' else '0' | c <- n] main = getLine >>= putStrLn . solve