func_code_string: #include <bits/stdc++.h>   using namespace std;   void solve() {}   const int maxn = (int)1e6 + 420;   const int MOD = (int)1e9 + 7;   int n;   int dp[maxn][4][4];   void contr() {     cout << 0 <<   n ;     exit(0);   }   int madd(int a, int b) {     long long sum = a + b;     sum %= MOD;     return sum;   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     string s;     cin >> s;     n = (int)s.size();     s =  .  + s;     dp[0][0][0] = 1;     for (int i = 1; i <= n; i++) {       for (int l = 0; l <= 3; l++) {         for (int m = 0; m <= 3; m++) {           for (int r = 0; r <= 3; r++) {             if ((i == 1) and !(l == 0 and m == 0)) continue;             if ((i == 2) and !(l == 0)) continue;             bool ok = true;             if (i >= 2) {               if (m == 0 and (l == 3 or r == 3)) {                 ok = false;                 continue;               }               if (m == 1 and !(l == 3 ^ r == 3)) {                 ok = false;                 continue;               }               if (m == 2 and (l != 3 or r != 3)) {                 ok = false;                 continue;               }             }             if (r == 0 and m == 3) {               ok = false;               continue;             }             if (r == 2 and m != 3) {               ok = false;               continue;             }             if (r == 1 and i == n and m != 3) {               ok = false;               continue;             }             if (r == 2 and i == n) {               ok = false;               continue;             }             vector<int> v = {r, m, l};             for (int j = 0; j < 3; j++) {               if (s[i - j] ==  ? ) continue;               if (i - j < 1) continue;               if ((v[j] == 3)) {                 if (s[i - j] !=  * ) {                   ok = false;                   continue;                 }               } else if (s[i - j] -  0  != v[j]) {                 ok = false;                 continue;               }             }             if (ok) {               dp[i][m][r] = madd(dp[i][m][r], dp[i - 1][l][m]);             }           }         }       }     }     int ans = 0;     for (int i = 0; i <= 3; i++) {       for (int j = 0; j <= 3; j++) {         ans = madd(ans, dp[n][i][j]);       }     }     cout << ans <<   n ;   }   