import Data.Bits
import Data.Char

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

main = do
    s <- getLine
    let bit = (2 ^ (length s - 1)) - 1
    print $ sum $ map (\b -> solve (map digitToInt s) b) [0..bit]