calc :: String -> Int
calc = sum . map (sum . map read) . splits
    where splits [] = []
          splits xs = [xs] : concatMap (cat . fmap splits . flip splitAt xs) [1..length xs - 1]
          cat (x, xs) = map (x :) xs

main :: IO ()
main = getLine >>= print . calc
