import itertools S = list(input()) Q = [0]*len(S) Z = [0]*len(S) mod = 998244353 for i,s in enumerate(S): if s=='0': Z[i]=1 if s=='?': Q[i]=1 ZAC = list(itertools.accumulate(Z)) QAC = list(itertools.accumulate(Q)) ans = 0 def modinv(a): return pow(a, mod-2, mod) div2 = modinv(2) for i,s in enumerate(S): if i==0 or i==len(S)-1: continue if s=='1' or s=='?': leftZ = ZAC[i-1] leftQ = QAC[i-1] rightZ = ZAC[-1]-ZAC[i] rightQ = QAC[-1]-QAC[i] left = (pow(2,leftQ,mod)*(leftZ+leftQ*div2))%mod right = (pow(2,rightQ,mod)*(rightZ+rightQ*div2))%mod ans = (ans+left*right)%mod print(ans)