import Control.Applicative
import Data.List.Split (splitOn)

expand :: [String] -> String -> [String]
expand ans [] = ans
expand l (c:s) = expand (concatMap (\ss->[ ss++'+':[c], ss++[c] ]) l) s

eval s = sum $ map read $ splitOn "+" s

main = do
  (c:s) <- getLine :: IO String
  print $ sum $ map eval $ expand [[c]] s
