#include <bits/stdc++.h>   using namespace std;   long long f[1000001][4][2];   string s;   signed main() {     cin >> s;     for (long long lst = 0; lst < 4; lst++)       f[s.length()][lst][0] = f[s.length()][lst][1] = 0;     f[s.length()][0][0] = f[s.length()][1][0] = f[s.length()][3][0] = 1;     for (long long i = s.length() - 1; i >= 0; --i) {       for (long long lst = 0; lst < 4; lst++) {         f[i][lst][0] = f[i][lst][1] = 0;         if (s[i] ==  * )           f[i][lst][1] = (f[i + 1][3][1] + f[i + 1][3][0]) % 1000000007;         else if (s[i] !=  ? ) {           long long c = s[i] -  0 ;           if (lst == 3) c--;           if (c >= 0 && c < 2) f[i][lst][0] = f[i + 1][s[i] -  0 ][c];         } else {           long long c = (lst == 3);           f[i][lst][0] = (f[i + 1][c][0] + f[i + 1][c + 1][1]) % 1000000007;           f[i][lst][1] = (f[i + 1][3][1] + f[i + 1][3][0]) % 1000000007;         }       }     }     cout << (f[0][0][0] + f[0][1][1]) % 1000000007;   }   