#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
long long dp[1000006][5];
int main() {
  string s;
  cin >> s;
  if (s[0] == '0' || s[0] == '?') dp[0][0] = 1;
  if (s[0] == '1' || s[0] == '?') dp[0][2] = 1;
  if (s[0] == '*' || s[0] == '?') dp[0][4] = 1;
  int i, j, k = s.size();
  for (j = 1; j < k; j++) {
    if (s[j] == '0' || s[j] == '?') {
      dp[j][0] = dp[j - 1][1] + dp[j - 1][0];
      dp[j][0] %= 1000000007;
    }
    if (s[j] == '1' || s[j] == '?') {
      dp[j][1] = dp[j - 1][4];
      dp[j][2] = dp[j - 1][0] + dp[j - 1][1];
      dp[j][1] %= 1000000007;
      dp[j][2] %= 1000000007;
    }
    if (s[j] == '2' || s[j] == '?') {
      dp[j][3] = dp[j - 1][4];
      dp[j][3] %= 1000000007;
    }
    if (s[j] == '*' || s[j] == '?') {
      dp[j][4] = dp[j - 1][2] + dp[j - 1][4] + dp[j - 1][3];
      dp[j][4] %= 1000000007;
    }
  }
  long long ans = dp[k - 1][0] + dp[j - 1][1] + dp[j - 1][4];
  ans %= 1000000007;
  cout << ans;
  return 0;
}
