S=input() P=998244353 Q=(P+1)//2 Z=H=z=h=a=0 for s in S: Z+=s<'1' H+=s>'1' p=1 R=q=pow(2,H,P) for s in S: b=s>'1' if s<'1':z+=1 else:a,h,p,q=a+(z+h*Q)*R*[1,Q][b]*((Z-z)+(H-h-b)*Q)%P,h+b,p*(1+b)%P,q*[1,Q][b]%P print(a%P)