import Control.Monad

main :: IO ()
main = do
  s <- getLine
  print $ sum $ map read . filter (not . null) $ concat $ splits s

splits :: [a] -> [[[a]]]
splits xs = map (`split` xs) $ filterM (const [True, False]) [1..length xs - 1]

split :: [Int] -> [a] -> [[a]]
split [] xs = [xs]
split _ [] = []
split (i:is) xs = let
    (ls, rs) = splitAt i xs
  in ls : split (map (subtract i) is) rs
