main = do
    s <- getLine

    print $ solve [] [read [x] :: Int | x <- s]

    
solve :: [Int] -> [Int] -> Int
solve xs [] = sum xs
solve [] (y:ys) = solve [y] ys
solve (x:xs) (y:ys) = solve (y:x:xs) ys + solve ((10 * x + y):xs) ys
