#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
const int MOD = 1e9 + 7;
const int N = 1e6 + 4;
int add(int a, int b) { return ((a % MOD) + (b % MOD)) % MOD; }
string s;
int memo[N][2][2][2], n;
int solve(int i, bool thereisaBOMB, bool canbeaBOMB, bool mustbeaBOMB) {
  if (i == n) {
    return !mustbeaBOMB;
  }
  int &ret = memo[i][thereisaBOMB][canbeaBOMB][mustbeaBOMB];
  if (~ret) return ret;
  ret = 0;
  if (s[i] == '?') {
    if (thereisaBOMB) {
      ret = add(ret, solve(i + 1, 1, 1, 0));
      ret = add(ret, solve(i + 1, 0, 1, 1));
      ret = add(ret, solve(i + 1, 0, 0, 0));
    } else if (mustbeaBOMB) {
      ret = add(ret, solve(i + 1, 1, 1, 0));
    } else if (!canbeaBOMB) {
      ret = add(ret, solve(i + 1, 0, 0, 0));
      ret = add(ret, solve(i + 1, 0, 1, 1));
    } else {
      ret = add(ret, solve(i + 1, 1, 1, 0));
      ret = add(ret, solve(i + 1, 0, 0, 0));
      ret = add(ret, solve(i + 1, 0, 1, 1));
    }
  } else {
    if (s[i] == '*') {
      if (!canbeaBOMB) return 0;
      ret = add(ret, solve(i + 1, 1, 1, 0));
    } else if (s[i] == '0') {
      if (mustbeaBOMB || thereisaBOMB) return 0;
      ret = add(ret, solve(i + 1, 0, 0, 0));
    } else if (s[i] == '1') {
      if (mustbeaBOMB) return 0;
      ret = add(ret, solve(i + 1, 0, !thereisaBOMB, !thereisaBOMB));
    } else {
      if (mustbeaBOMB || !thereisaBOMB) return 0;
      ret = add(ret, solve(i + 1, 0, 1, 1));
    }
  }
  return ret;
}
int main() {
  cin >> s;
  n = (int)s.size();
  memset(memo, -1, sizeof memo);
  printf("%d\n", solve(0, 0, 1, 0));
}
