#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
const int N = 1e6 + 100;
long long int dp[N][6];
map<char, int> mapa;
string s;
bool pau(int x, int last) {
  if (last == 0) {
    if (x == 0 or x == 4) return false;
    return true;
  }
  if (last == 1) {
    if (x == 0 or x == 4) return false;
    return true;
  }
  if (last == 2) {
    if (x == 3) return false;
    return true;
  }
  if (last == 3) {
    if (x == 1 or x == 2 or x == 3) return false;
    return true;
  }
  if (last == 4) {
    if (x == 3) return false;
    return true;
  }
  if (last == 5) {
    if (x == 0 or x == 4 or x == 3) return false;
    return true;
  }
  return false;
}
long long int solve(int pos, int last) {
  if (pos == s.size()) {
    if (last != 4 and last != 2)
      return 1;
    else
      return 0;
  }
  if (dp[pos][last] != -1) {
    return dp[pos][last];
  }
  long long int ret = 0;
  if (s[pos] == '?') {
    for (int i = 0; i < 5; i++) {
      if (!pau(i, last)) {
        ret += solve(pos + 1, i);
        ret %= MOD;
      }
    }
  } else {
    int x = mapa[s[pos]];
    if (x == 1) {
      if (last != 3)
        x = 4;
      else
        x = 1;
    }
    if (!pau(x, last)) ret = solve(pos + 1, x);
  }
  return dp[pos][last] = ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> s;
  mapa['0'] = 0;
  mapa['1'] = 1;
  mapa['2'] = 2;
  mapa['*'] = 3;
  long long int resp = solve(0, 5);
  cout << resp << "\n";
  return 0;
}
