import Data.Char
ctoi :: Char -> Int
ctoi x = ord x - ord '0'


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

main :: IO ()
main = do
    s <- getLine
    let n = map (ctoi) s
    print $ dfs 0 0 n