main :: IO () main = do s <- getLine print $ foldr f 0 s where f c v = (+) v $ if isdigit c then fromEnum c - fromEnum '0' else 0 isdigit c = '0' <= c && c <= '9'