#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int n;
char s[1000001];
int main() {
  scanf("%s", s);
  n = strlen(s);
  long long s0 = 0, s1 = 0, s2 = 0, s1x = 0, sx = 0;
  switch (s[0]) {
    case '0':
      ++s0;
      break;
    case '1':
      ++s1;
      break;
    case '2':
      printf("0\n");
      return 0;
    case '*':
      ++sx;
      break;
    case '?':
      ++s0;
      ++s1;
      ++sx;
      break;
  }
  for (int i = 1; i < n; ++i) {
    long long t0 = 0, t1 = 0, t2 = 0, t1x = 0, tx = 0;
    switch (s[i]) {
      case '0':
        t0 = s0 + s1x;
        break;
      case '1':
        t1 = s0 + s1x;
        t1x = sx;
        break;
      case '2':
        t2 = sx;
        break;
      case '*':
        tx = s1 + sx + s2;
        break;
      case '?':
        t0 = s0 + s1x;
        t1 = s0 + s1x;
        t2 = sx;
        t1x = sx;
        tx = s1 + s2 + sx;
        break;
    }
    s0 = t0 % mod;
    s1 = t1 % mod;
    sx = tx % mod;
    s2 = t2 % mod;
    s1x = t1x % mod;
    ++i;
    --i;
  }
  printf("%I64d\n", (s0 + sx + s1x) % mod);
  return 0;
}
