#include <bits/stdc++.h>
using namespace std;
long long dp[1000006][5] = {0};
int main() {
  ios::sync_with_stdio(false);
  string str;
  cin >> str;
  if (str[0] == '0' || str[0] == '?') {
    dp[0][0] = 1;
  }
  if (str[0] == '1' || str[0] == '?') {
    dp[0][2] = 1;
  }
  if (str[0] == '*' || str[0] == '?') {
    dp[0][4] = 1;
  }
  for (int i = 1; i < str.length(); i++) {
    if (str[i] == '0' || str[i] == '?') {
      dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
      dp[i][0] %= 1000000007;
    }
    if (str[i] == '1' || str[i] == '?') {
      dp[i][1] = dp[i - 1][4];
      dp[i][2] = dp[i - 1][0] + dp[i - 1][1];
      dp[i][1] %= 1000000007;
      dp[i][2] %= 1000000007;
    }
    if (str[i] == '2' || str[i] == '?') {
      dp[i][3] = dp[i - 1][4];
      dp[i][3] %= 1000000007;
    }
    if (str[i] == '*' || str[i] == '?') {
      dp[i][4] = dp[i - 1][2] + dp[i - 1][3] + dp[i - 1][4];
      dp[i][4] %= 1000000007;
    }
  }
  long long ans = dp[str.length() - 1][0] + dp[str.length() - 1][1] +
                  dp[str.length() - 1][4];
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
