#include <bits/stdc++.h>
using namespace std;
string s;
long long int dp[1000007][5][5];
long long int go(int curr, int p, int px) {
  if (curr >= s.size()) {
    return 1;
  }
  long long int &ret = dp[curr][p][px];
  if (ret != -1) return ret;
  ret = 0;
  if (s[curr] == '?') {
    bool f0 = true, f1 = true, f2 = true, f3 = true;
    if (p == 3) f0 = false;
    if (p == 1 and px != 3) f0 = false, f1 = false, f2 = false;
    if (p == 2 and px != 3) return 0;
    if (p == 2) f0 = false, f1 = false, f2 = false;
    if (p == 2) f0 = false;
    if (p != 3 and curr + 1 >= s.size()) f1 = false;
    if (p != 3 and (s[curr + 1] != '?' and s[curr + 1] != '*')) f1 = false;
    if (p != 3) f2 = false;
    if (curr + 1 >= s.size()) f2 = false;
    if (s[curr + 1] != '?' and s[curr + 1] != '*') f2 = false;
    if (p == 1 and px == 3) f3 = false;
    if (p == 0) f3 = false;
    if (f0) ret = (go(curr + 1, 0, p) + ret) % 1000000007;
    if (f1) ret = (go(curr + 1, 1, p) + ret) % 1000000007;
    if (f2) ret = (go(curr + 1, 2, p) + ret) % 1000000007;
    if (f3) ret = (go(curr + 1, 3, p) + ret) % 1000000007;
  } else if (s[curr] == '0') {
    if (p == 3 or (p == 1 and px != 3) or p == 2) {
      return 0;
    }
    return ret = go(curr + 1, 0, p);
  } else if (s[curr] == '1') {
    if (p == 1 and px != 3) {
      return 0;
    }
    if (p != 3 and curr + 1 >= s.size()) {
      return 0;
    }
    if (p != 3 and (s[curr + 1] != '?' and s[curr + 1] != '*')) {
      return 0;
    }
    return ret = go(curr + 1, 1, p);
  } else if (s[curr] == '2') {
    if (p != 3) {
      return 0;
    }
    if (p == 1 and px != 3) {
      return 0;
    }
    if (curr + 1 >= s.size()) {
      return 0;
    }
    if (s[curr + 1] != '?' and s[curr + 1] != '*') {
      return 0;
    }
    return ret = go(curr + 1, 2, p);
  } else if (s[curr] == '*') {
    if (p == 1 and px == 3) {
      return 0;
    }
    if (p == 0) {
      return 0;
    }
    return ret = go(curr + 1, 3, p);
  }
  return ret;
}
int main(int argc, char const *argv[]) {
  memset(dp, -1, sizeof dp);
  cin >> s;
  cout << go(0, 4, 4) << endl;
  return 0;
}
