import Data.Char
import Data.Bits

solve :: [Int] -> Int -> [Int]
solve xs i
  | i == 0 = [loop xs i] 
  | otherwise = loop xs i : solve xs (i-1)
  where
    loop :: [Int] -> Int -> Int
    loop [x] _ = x
    loop (x:y:xs) j 
      | j .&. 1 == 1 = x + loop (y:xs) (shiftR j 1)
      | otherwise = loop (10*x+y:xs) (shiftR j 1)

main = do
  xs <- map digitToInt <$> getLine :: IO [Int]
  print $ sum $ solve xs (2 ^ (length xs - 1) - 1)