import Control.Monad
import Data.Char
main = do
    (x:xs) <- map digitToInt <$> getLine
    let exprs = foldM (\(acc,top) cur -> [(acc+top,cur),(acc,10*top+cur)]) (0,x) xs
        ans = sum $ map (uncurry (+)) exprs    
    print ans