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