import Data.Bits
import Data.Char

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

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