import Data.Char (digitToInt)

main :: IO ()
main = print . solve . map (fromIntegral . digitToInt) =<< getLine

solve :: [Integer] -> Integer
solve xs = sum [ 2 ^ (max (i - 1) (length xs - 2 - j)) * 10 ^ j * x | (i, x) <- zip [1..] xs, j <- [0 .. length xs - i] ]
