import qualified Data.Set as S

main :: IO ()
main = print . sum . map (sum . map read . words) . solve =<< getLine

solve :: String -> [String]
solve [c] = [[c]]
solve (c:s) = map (\x -> c:' ':x) (solve s) ++ map (c:) (solve s)