
stoi :: String -> Int 
stoi x = read x :: Int


dfs :: Int -> Int -> String -> Int
dfs sum buff rest
    | length rest == 0 = sum + buff
    | otherwise = use + unuse
    where
        head' = stoi [head rest]
        rest' = (tail rest)
        use = dfs (sum + buff) 0 rest'
        unuse = dfs sum (buff * 10 + head') rest'

main :: IO ()
main = do
    x <- getLine
    print $ dfs 0 0 x