#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
char s[N];
struct din {
  unsigned int zvezda, nil, one, one_noleft, two;
  din() { zvezda = nil = one = one_noleft = two = 0; }
};
din d[N];
const unsigned int mod = 1000000007;
int main() {
  gets(s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    char cr = s[i];
    switch (cr) {
      case '*':
        d[i].zvezda =
            ((i == 0) ? 1
                      : d[i - 1].one_noleft + d[i - 1].zvezda + d[i - 1].two) %
            mod;
        break;
      case '0':
        d[i].nil = ((i == 0) ? 1 : d[i - 1].nil + d[i - 1].one) % mod;
        break;
      case '1':
        d[i].one = ((i == 0) ? 0 : d[i - 1].zvezda) % mod;
        d[i].one_noleft = ((i == 0) ? 1 : d[i - 1].one + d[i - 1].nil) % mod;
        break;
      case '2':
        d[i].two = ((i == 0) ? 0 : d[i - 1].zvezda) % mod;
        break;
      case '?':
        d[i].zvezda =
            ((i == 0) ? 1
                      : d[i - 1].one_noleft + d[i - 1].zvezda + d[i - 1].two) %
            mod;
        d[i].nil = ((i == 0) ? 1 : d[i - 1].nil + d[i - 1].one) % mod;
        d[i].one = ((i == 0) ? 0 : d[i - 1].zvezda) % mod;
        d[i].one_noleft = ((i == 0) ? 1 : d[i - 1].one + d[i - 1].nil) % mod;
        d[i].two = ((i == 0) ? 0 : d[i - 1].zvezda) % mod;
        break;
    }
  }
  unsigned int sum = 0;
  sum = (sum + d[len - 1].zvezda) % mod;
  sum = (sum + d[len - 1].one) % mod;
  sum = (sum + d[len - 1].nil) % mod;
  cout << sum << endl;
  cin.get();
  cin.get();
  return 0;
}
