#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int f[2][3];
int x, i;
char c;
inline void qm(int& a, const int& b) { (a += b) >= mod ? (a -= mod) : a; }
int main() {
  c = getchar();
  while (c <= 32) c = getchar();
  f[0][0] = f[0][1] = 1;
  for (x = 1; c > 32; x++, c = getchar()) {
    i = x & 1;
    switch (c) {
      case '0': {
        f[i][0] = f[i ^ 1][0];
        f[i][1] = 0;
        f[i][2] = 0;
        break;
      }
      case '1': {
        f[i][1] = f[i ^ 1][0];
        f[i][0] = f[i ^ 1][2];
        f[i][2] = 0;
        break;
      }
      case '2': {
        f[i][1] = f[i ^ 1][2];
        f[i][2] = 0;
        f[i][0] = 0;
        break;
      }
      case '*': {
        f[i][0] = 0;
        f[i][1] = 0;
        f[i][2] = f[i ^ 1][1];
        qm(f[i][2], f[i ^ 1][2]);
        break;
      }
      case '?': {
        f[i][0] = f[i ^ 1][0];
        qm(f[i][0], f[i ^ 1][2]);
        f[i][1] = f[i ^ 1][0];
        qm(f[i][1], f[i ^ 1][2]);
        f[i][2] = f[i ^ 1][1];
        qm(f[i][2], f[i ^ 1][2]);
        break;
      }
    }
  }
  x--;
  printf("%d", (f[x & 1][0] + f[x & 1][2]) % mod);
  return 0;
}
