main :: IO ()
main = do
  str <- getLine
  print $ solve str

solve :: String -> Int
solve (s:ss) = dfs [read [s]] ss
  where
    dfs :: [Int] -> String -> Int
    dfs res [] = sum res
    dfs ints@(i:is) (r:rs) =
      (dfs ((10*i + read [r]):is) rs) + (dfs ((read [r]):ints) rs)
