import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.List
import Data.Char

analyze :: Int -> Int -> VU.Vector Int -> [Int] -> Int
analyze x n ys []     = x + (vectorToTen $ VU.drop n ys)
analyze x n ys (z:zs) = analyze (x+(vectorToTen $ VU.slice n (z-n) ys)) z ys zs

main :: IO ()
main = do
    s <- getLine
    let ys = VU.fromList $ map digitToInt s 
    print $ if length s == 1 then digitToInt $ head s else sum $ map (analyze 0 0 ys) (powerSet [1..length s -1])


vectorToTen :: VU.Vector Int -> Int
vectorToTen xs = if VU.null xs then 0 else 10*(vectorToTen $ VU.init xs) + VU.last xs

powerSet :: [a] -> [[a]]
powerSet = filterM (\x -> [True,False])