#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010101;
const int mod = 1000000007;
int n, dp[MAXN][5];
char str[MAXN];
int main() {
  scanf("%s", str);
  n = strlen(str);
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  dp[0][2] = 1;
  for (int i = 1; i <= n; i++) {
    if (str[i - 1] == '0' || str[i - 1] == '?')
      dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % mod;
    if (str[i - 1] == '1' || str[i - 1] == '?') {
      dp[i][1] = dp[i - 1][4];
      dp[i][2] = (dp[i - 1][0] + dp[i - 1][1]) % mod;
    }
    if (str[i - 1] == '2' || str[i - 1] == '?') dp[i][3] = dp[i - 1][4];
    if (str[i - 1] == '*' || str[i - 1] == '?')
      dp[i][4] = (dp[i - 1][4] + (dp[i - 1][2] + dp[i - 1][3]) % mod) % mod;
  }
  int res = 0;
  res = (res + dp[n][0]) % mod;
  res = (res + dp[n][1]) % mod;
  res = (res + dp[n][4]) % mod;
  printf("%d\n", res);
  return 0;
}
