S=list(input()) i=0 Co=[] while i1: St=len(Co) if len(Co)%2==1: St-=1 else: St=0 Nw=0 if St>2 and Co[St-1]==1 : Nw+=1 St-=2 while St>1: Nw+=Co[St-1] Nw1=Nw-1 Nw1*=Nw Nw1//=2 Sc+=Nw1*Co[St-2] St-=2 print (Sc)