{-# LANGUAGE BangPatterns #-}

import           Data.Char

main :: IO ()
main = solve <$> getLine >>= print

solve :: String -> Int
solve xs = let (y:ys) = digitToInt <$> xs in go 0 y ys
    where
        go !a !y []     = a + y
        go !a !y (z:zs) = go (a + y) z zs + go a (y * 10 + z) zs
