#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> s;
  n = s.size();
  long long dp[n][5];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 5; j++) dp[i][j] = 0;
  }
  dp[0][0] = dp[0][1] = dp[0][3] = 1;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < 5; j++) {
      dp[i][j] = dp[i][j] % 1000000007;
      if (s[i] == '0' && j != 0) dp[i][j] = 0;
      if (s[i] == '1' && (j != 1) && (j != 4)) dp[i][j] = 0;
      if (s[i] == '2' && j != 2) dp[i][j] = 0;
      if (s[i] == '*' && j != 3) dp[i][j] = 0;
      if (j == 0) {
        dp[i + 1][0] += dp[i][j];
        dp[i + 1][1] += dp[i][j];
      }
      if (j == 1) {
        dp[i + 1][3] += dp[i][j];
      }
      if (j == 2) {
        dp[i + 1][3] += dp[i][j];
      }
      if (j == 3) {
        dp[i + 1][2] += dp[i][j];
        dp[i + 1][3] += dp[i][j];
        dp[i + 1][4] += dp[i][j];
      }
      if (j == 4) {
        dp[i + 1][0] += dp[i][j];
        dp[i + 1][1] += dp[i][j];
      }
    }
  }
  if (s[n - 1] == '0') cout << (dp[n - 1][0]) % 1000000007 << "\n";
  if (s[n - 1] == '1') cout << (dp[n - 1][4]) % 1000000007 << "\n";
  if (s[n - 1] == '2') cout << 0 << "\n";
  if (s[n - 1] == '*') cout << (dp[n - 1][3]) % 1000000007 << "\n";
  if (s[n - 1] == '?')
    cout << (dp[n - 1][0] + dp[n - 1][3] + dp[n - 1][4]) % 1000000007 << "\n";
}
