import Data.List
import Data.Maybe
import Data.Bits
import Data.Char
import qualified Data.ByteString.Char8 as BS
import Control.Monad

main = do
	s <- BS.getLine
	print $ solve $ map digitToInt $ BS.unpack $ s

solve :: [Int] -> Int
solve [] = 0
solve [a] = a
solve (a:b:xs) = a `shiftL` (length xs) + solve (a*10+b:xs) + solve (b:xs)

-- IO --
readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

readIntList :: BS.ByteString -> [Int]
readIntList = map readInt . BS.words

getInt :: IO Int
getInt = readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = readIntList <$> BS.getLine