import Control.Applicative import Data.List main :: IO () main = solve <$> readLn <*> readLn >>= print solve :: Int -> Int -> Int solve a b = foldr g 0 $ unfoldr f $ a + b where f x = if x == 0 then Nothing else Just $ let (q, r) = x `divMod` 10 in (r, q) g x z = z * 2 + (if x == 1 then 1 else 0)