#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, M = 1e9 + 7;
char ch[N];
long long dp[N][5];
int main() {
  cin >> ch;
  int len = strlen(ch);
  if (ch[0] == '?') dp[0][0]++, dp[0][1]++, dp[0][3]++;
  if (ch[0] == '1') dp[0][1]++;
  if (ch[0] == '0') dp[0][0]++;
  if (ch[0] == '*') dp[0][3]++;
  for (int i = 1; i < len; i++) {
    if (ch[i] == '*' || ch[i] == '?') {
      dp[i][3] = (dp[i][3] + dp[i - 1][3]) % M;
      dp[i][3] = (dp[i][3] + dp[i - 1][1]) % M;
      dp[i][3] = (dp[i][3] + dp[i - 1][4]) % M;
    }
    if (ch[i] == '0' || ch[i] == '?') {
      dp[i][0] = (dp[i][0] + dp[i - 1][2]) % M;
      dp[i][0] = (dp[i][0] + dp[i - 1][0]) % M;
    }
    if (ch[i] == '1' || ch[i] == '?') {
      dp[i][1] = (dp[i][1] + dp[i - 1][0]) % M;
      dp[i][2] = (dp[i][2] + dp[i - 1][3]) % M;
      dp[i][1] = (dp[i][1] + dp[i - 1][2]) % M;
    }
    if (ch[i] == '2' || ch[i] == '?') {
      dp[i][4] = (dp[i][4] + dp[i - 1][3]) % M;
    }
  }
  long long ans = dp[len - 1][0] + dp[len - 1][3];
  ans %= M;
  ans = (ans + dp[len - 1][2]) % M;
  cout << ans << endl;
}
