#include using namespace std; const long long MOD = 998244353; int main(){ string S; cin >> S; string T = "010."; int N = S.size(); vector> dp(4, vector(N + 1, 0)); dp[0][0] = 1; for (int i = 0; i < N; i++){ for (int j = 0; j <= 3; j++){ if (S[i] == '0' || S[i] == '?'){ dp[j][i + 1] += dp[j][i]; if (T[j] == '0'){ dp[j + 1][i + 1] += dp[j][i]; } } if (S[i] == '1' || S[i] == '?'){ dp[j][i + 1] += dp[j][i]; if (T[j] == '1'){ dp[j + 1][i + 1] += dp[j][i]; } } } } cout << dp[3][N] << endl; }