#include <bits/stdc++.h>
using namespace std;
long long dp[1000007][4][4];
void add(long long &a, long long b) { a = (b + a) % 1000000007; }
char str[1000007];
int solve() {
  int n = strlen(str);
  if (str[0] == '?') {
    dp[0][0][0] = dp[0][0][1] = dp[0][0][2] = dp[0][3][3] = 1;
  } else if (str[0] == '*')
    dp[0][3][3] = 1;
  else
    dp[0][0][str[0] - '0'] = 1;
  for (int i = 1; i < n; ++i) {
    if (str[i] == '0' || str[i] == '?') {
      add(dp[i][0][0], dp[i - 1][0][0] + dp[i - 1][1][0] + dp[i - 1][3][0]);
      add(dp[i][1][0], dp[i - 1][3][1]);
    }
    if (str[i] == '1' || str[i] == '?') {
      add(dp[i][0][1], dp[i - 1][0][0] + dp[i - 1][1][0]);
      add(dp[i][1][1], dp[i - 1][3][1]);
      add(dp[i][3][1], dp[i - 1][1][3] + dp[i - 1][2][3] + dp[i - 1][3][3]);
    }
    if (str[i] == '2' || str[i] == '?') {
      add(dp[i][3][2], dp[i - 1][1][3] + dp[i - 1][2][3] + dp[i - 1][3][3]);
    }
    if (str[i] == '*' || str[i] == '?') {
      add(dp[i][1][3], dp[i - 1][0][1] + dp[i - 1][1][1]);
      add(dp[i][2][3], dp[i - 1][3][2]);
      add(dp[i][3][3], dp[i - 1][1][3] + dp[i - 1][2][3] + dp[i - 1][3][3]);
    }
  }
  long long ans = 0;
  --n;
  add(ans, dp[n][0][0] + dp[n][1][0] + dp[n][1][3] + dp[n][2][3] + dp[n][3][1] +
               dp[n][3][3]);
  return ans;
}
int main() {
  scanf("%s", str);
  printf("%d\n", solve());
}
