#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
inline int read() {
  int res, ok = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') ok = -1;
  res = ch - '0';
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    res = res * 10 + ch - '0';
  return res * ok;
}
char s[1000005];
int n;
long long dp[1000005][5];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  if (s[1] == '0')
    dp[1][0] = 1;
  else if (s[1] == '1')
    dp[1][2] = 1;
  else if (s[1] == '2') {
    printf("0\n");
    return 0;
  } else if (s[1] == '*')
    dp[1][4] = 1;
  else
    dp[1][0] = dp[1][2] = dp[1][4] = 1;
  for (int i = 2; i <= n; i++) {
    if (s[i] == '0' || s[i] == '?')
      dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % mod;
    if (s[i] == '1' || s[i] == '?') {
      dp[i][1] = dp[i - 1][4];
      dp[i][2] = (dp[i - 1][0] + dp[i - 1][1]) % mod;
    }
    if (s[i] == '2' || s[i] == '?') dp[i][3] = dp[i - 1][4];
    if (s[i] == '*' || s[i] == '?')
      dp[i][4] = (dp[i - 1][2] + dp[i - 1][3] + dp[i - 1][4]) % mod;
  }
  printf("%I64d\n", (dp[n][0] + dp[n][1] + dp[n][4]) % mod);
  return 0;
}
