l=s=0 for c in input():l+=c>'0'or(s:=s+l//2)*(l&1==0) print(s)