S=input() mod=998244353 dp=[0]*4 dp[0]=1 for s in S: prev=dp dp=[0]*4 if s in "0?": for i in range(4): dp[i]+=prev[i] dp[1]+=prev[0] dp[3]+=prev[2] if s in "1?": for i in range(4): dp[i]+=prev[i] dp[2]+=prev[1] for i in range(4): dp[i]%=mod ans=dp[3] print(ans)