#include <bits/stdc++.h>
using namespace std;
inline long long pos_mod(long long i, long long n) { return (i % n + n) % n; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  vector<long long> B(n);
  vector<long long> A0(n);
  vector<long long> A1(n);
  if (s[0] == '0') {
    A0[0] = 1;
  }
  if (s[0] == '1') {
    A1[0] = 1;
  }
  if (s[0] == '2') {
    ;
  }
  if (s[0] == '*') {
    B[0] = 1;
  }
  if (s[0] == '?') {
    A0[0] = 1;
    A1[0] = 1;
    B[0] = 1;
  }
  for (int i = 1; i < n; i++) {
    if (s[i] == '0') {
      A0[i] += A0[i - 1];
    }
    if (s[i] == '1') {
      A0[i] += B[i - 1];
      A1[i] += A0[i - 1];
    }
    if (s[i] == '2') {
      A1[i] += B[i - 1];
    }
    if (s[i] == '*') {
      B[i] += B[i - 1] + A1[i - 1];
    }
    if (s[i] == '?') {
      A0[i] += A0[i - 1];
      A0[i] += B[i - 1];
      A1[i] += A0[i - 1];
      A1[i] += B[i - 1];
      B[i] += B[i - 1] + A1[i - 1];
    }
    A0[i] %= 1000000007;
    A1[i] %= 1000000007;
    B[i] %= 1000000007;
  }
  cout << (A0[n - 1] + B[n - 1]) % 1000000007 << endl;
}
