import Data.Char
import Data.List

main = print . sum . map (read :: String -> Int) . concat . sub =<< getLine

sub [s] = [(s:"")]:[]
sub (s:ss) = let sub's = sub ss in (map (\(x:xs) -> (s:x):xs) sub's) ++ (map ([s]:) sub's)
