main = do
    s <- getLine
    print $ sum (map read (concat (decompose s)))

decompose :: String -> [[String]]
decompose st
    | length st == 1 = [[st]]
    | otherwise = (map ([head st]:) (decompose (tail st))) ++ [((head st):y):ys | (y:ys) <- decompose (tail st) ]