#include <bits/stdc++.h>
using namespace std;
char arr[1000000 + 10];
long long dp[1000000 + 10][5], mod = 1000000007;
int main() {
  scanf("%s", arr + 1);
  int n = strlen(arr + 1);
  dp[0][0] = 1;
  dp[0][1] = 1;
  for (int i = 1; i <= n; i++) {
    char x = arr[i];
    if (x == '0' || x == '?') dp[i][0] = (dp[i - 1][0] + dp[i - 1][2]) % mod;
    if (x == '1' || x == '?')
      dp[i][1] = (dp[i - 1][0] + dp[i - 1][2]) % mod, dp[i][2] = dp[i - 1][4];
    if (x == '2' || x == '?') dp[i][3] = dp[i - 1][4];
    if (x == '*' || x == '?')
      dp[i][4] = (dp[i - 1][4] + dp[i - 1][1] + dp[i - 1][3]) % mod;
  }
  cout << (dp[n][2] + dp[n][4] + dp[n][0]) % mod;
  return 0;
}
