import Data.Char

main = do
  xs <- getLine
  print $ sigma $ map digitToInt xs

sigma :: [Int] -> Int
sigma [] = 0
sigma [a] = a
sigma (a:b:cs) = a * 2^(length cs)
               + (sigma $ (a*10 + b):cs)
               + (sigma $ b:cs)
