#include <bits/stdc++.h>
using namespace std;
string s, st;
long long n, mod = 1e9 + 7, dp[1000001][3];
inline long long read() {
  long long sum = 0, x = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') x = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = sum * 10 + ch - '0';
    ch = getchar();
  }
  return sum * x;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
  return;
}
signed main() {
  cin >> st;
  s = ' ' + st;
  n = st.size();
  dp[0][0] = dp[0][1] = 1;
  for (register long long i = 1; i <= n; ++i) {
    if (s[i] == '0' || s[i] == '?') dp[i][0] = (dp[i][0] + dp[i - 1][0]) % mod;
    if (s[i] == '1' || s[i] == '?') {
      dp[i][1] = (dp[i][1] + dp[i - 1][0]) % mod;
      dp[i][0] = (dp[i][0] + dp[i - 1][2]) % mod;
    }
    if (s[i] == '2' || s[i] == '?') dp[i][1] = (dp[i][1] + dp[i - 1][2]) % mod;
    if (s[i] == '*' || s[i] == '?') {
      dp[i][2] = (dp[i][2] + dp[i - 1][2]) % mod;
      dp[i][2] = (dp[i][2] + dp[i - 1][1]) % mod;
    }
  }
  write((dp[n][0] + dp[n][2]) % mod);
  return 0;
}
