MOD = 998244353 S = input() N = len(S) if N < 3: print(0) exit() def solve(): dp = [[0] * 4 for _ in range(N + 1)] dp[0][0] = 1 for i in range(N): tmp = 0 if S[i] == "0" or S[i] == "?": dp[i+1][1] += dp[i][0] dp[i+1][3] += dp[i][2] tmp += 1 if S[i] == "1" or S[i] == "?": dp[i+1][2] += dp[i][1] tmp += 1 for j in range(4): dp[i+1][j] += dp[i][j] * tmp dp[i+1][j] %= MOD #print(i,dp) return dp[N][3] print(solve())