import Data.List
 
main = getLine >>= print . solve . (\s -> (s, 0))
 
solve = sum . unfoldr f 
 
f ([], _) = Nothing
f ([x], _) = Nothing
f (('1':xs), n) = Just (0, (xs, succ n))
f (('0':'1':xs), n) = Just (n, (xs, 0))
f (('0':'0':xs), _) = Just (0, (xs, 0))