from itertools import groupby s=input() n=len(s) s=[s[i] for i in range(n)] mod=924844033 data=groupby(s) data=[(key,len(list(group))) for key,group in data] Start=1 End=1 if data[0][0]=="0": Start+=data[0][1] data=data[1:] if not data: print(Start-1) exit() if data[-1][0]=="0": End+=data[-1][1] data.pop() comp=[0]*len(data) for i in range(len(data)): comp[i]=data[i][1] n=len(comp) if n==1: print(comp[0]*Start*End) exit() odd=[(comp[i],i//2) for i in range(n) if i%2==1] #print(odd) N=len(odd) ID=[-1]*n stack=[] for i in range(N): while stack and stack[-1][0]