import Data.List


main :: IO ()
main = do
    s <- getLine
    print $ solve (head s:[]) (tail s)

solve :: String -> String -> Int
solve ac []     = read (reverse ac)
solve ac (x:xs) = 2^(length xs) * (read (reverse ac)) + (solve (x:ac) xs) + (solve (x:[]) xs)



