solve :: String -> [String]
solve [c] = [[c]]
solve (c:cs) = do
  sub <- solve cs
  [c:sub, c:' ':sub]

main :: IO ()
main = do
  s <- sum . map (sum . map read . words) . solve <$> getLine 
  print s