import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getLine >>= print

solve :: String -> Int
solve xs = f xs

f :: String -> Int
f xs
  | null xs = 0
  | length xs == 1  = toInt xs
  | otherwise = (toInt xs) + sum (map (\(a,b) -> (read a) * (2 ^ (length b - 1)) + f b) ys)
  where
    ys = (tail . init) (zip (inits xs) (tails xs))
  

toInt :: String -> Int
toInt = read

getl :: (String -> a) -> IO a
getl f = f <$> getLine

getc :: ([String] -> a) -> IO a
getc f = f . lines <$> getContents
