#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
long long dp[1000001][2][2], n;
char pp[1000001];
long long go(int c, int l, int r) {
  if (c == n) return 1;
  long long &ret = dp[c][l][r];
  if (ret != -1) return ret;
  ret = 0;
  if (pp[c] == '?') {
    if (l == 0 && (c == n - 1 || pp[c + 1] == '?' || pp[c + 1] == '0' ||
                   pp[c + 1] == '1'))
      ret = (ret + go(c + 1, 0, 0)) % 1000000007ll;
    if (l == 1 && (c == n - 1 || pp[c + 1] == '?' || pp[c + 1] == '0' ||
                   pp[c + 1] == '1'))
      ret = (ret + go(c + 1, 0, 0)) % 1000000007ll;
    if (l == 0 && c < n - 1 && (pp[c + 1] == '?' || pp[c + 1] == '*'))
      ret = (ret + go(c + 2, 1, 1)) % 1000000007ll;
    if (l == 1 && c < n - 1 && (pp[c + 1] == '?' || pp[c + 1] == '*'))
      ret = (ret + go(c + 2, 1, 1)) % 1000000007ll;
    if (r == 1) ret = (ret + go(c + 1, 1, 1)) % 1000000007ll;
  } else if (pp[c] == '0') {
    if (l == 1) return ret;
    if (c == n - 1 || pp[c + 1] == '?' || pp[c + 1] == '0' || pp[c + 1] == '1')
      ret = (ret + go(c + 1, 0, 0)) % 1000000007ll;
  } else if (pp[c] == '1') {
    if (l == 1 && (c == n - 1 || pp[c + 1] == '?' || pp[c + 1] == '0' ||
                   pp[c + 1] == '1'))
      ret = (ret + go(c + 1, 0, 0)) % 1000000007ll;
    if (l == 0 && c < n - 1 && (pp[c + 1] == '?' || pp[c + 1] == '*'))
      ret = (ret + go(c + 2, 1, 1)) % 1000000007ll;
  } else if (pp[c] == '2') {
    if (l == 0) return ret;
    if (c < n - 1 && (pp[c + 1] == '?' || pp[c + 1] == '*'))
      ret = (ret + go(c + 2, 1, 1)) % 1000000007ll;
  } else if (pp[c] == '*') {
    if (r == 0) return ret;
    ret = (ret + go(c + 1, 1, 1)) % 1000000007ll;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long a = 0, b, c, d, e = 0, f = 0, g, h = 0, x, y, z;
  cin >> pp;
  n = strlen(pp);
  memset(dp, -1, sizeof dp);
  cout << go(0, 0, 1) << endl;
}
