#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
char s[maxn];
long long dp[maxn][5], ans = 0;
int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  dp[0][1] = dp[0][3] = 1;
  for (int i = 1; i <= len; ++i) {
    if (s[i] == '0') dp[i][1] = (dp[i - 1][2] + dp[i - 1][1]) % mod;
    if (s[i] == '1')
      dp[i][2] = dp[i - 1][0] % mod,
      dp[i][3] = (dp[i - 1][1] + dp[i - 1][2]) % mod;
    if (s[i] == '2') dp[i][4] = dp[i - 1][0] % mod;
    if (s[i] == '*')
      dp[i][0] = ((dp[i - 1][0] + dp[i - 1][3]) % mod + dp[i - 1][4]) % mod;
    if (s[i] == '?') {
      dp[i][1] = (dp[i - 1][2] + dp[i - 1][1]) % mod;
      dp[i][2] = dp[i - 1][0] % mod,
      dp[i][3] = (dp[i - 1][1] + dp[i - 1][2]) % mod;
      dp[i][4] = dp[i - 1][0] % mod;
      dp[i][0] = ((dp[i - 1][0] + dp[i - 1][3]) % mod + dp[i - 1][4]) % mod;
    }
  }
  printf("%lld\n", ((dp[len][0] + dp[len][1]) % mod + dp[len][2]) % mod);
}
