#include <bits/stdc++.h>
using namespace std;
long long dp[1000010][2];
string s;
int main() {
  cin >> s;
  s = '?' + s;
  int len = (int)s.size();
  dp[0][0] = 1;
  for (int i = 1; i < len; i++) {
    if (s[i] == '?') {
      if (s[i - 1] == '?') {
        dp[i][0] = dp[i][1] = (dp[i - 1][0] + dp[i - 1][1]) % 1000000007;
      } else if (s[i - 1] == '0') {
        dp[i][0] = dp[i - 1][0];
      } else if (s[i - 1] == '1') {
        dp[i][0] = dp[i - 2][1];
        dp[i][1] = dp[i - 2][0];
      } else if (s[i - 1] == '2') {
        dp[i][1] = dp[i - 2][1];
      } else if (s[i - 1] == '*') {
        dp[i][0] = dp[i][1] = dp[i - 1][1];
      }
    } else if (s[i] == '*') {
      if (s[i - 1] == '?') {
        dp[i][1] = (dp[i - 1][0] + dp[i - 1][1]) % 1000000007;
      } else if (s[i - 1] == '0') {
      } else if (s[i - 1] == '1') {
        dp[i][1] = dp[i - 2][0];
      } else if (s[i - 1] == '2') {
        dp[i][1] = dp[i - 2][1];
      } else if (s[i - 1] == '*') {
        dp[i][1] = dp[i - 1][1];
      }
    } else {
      if (s[i] == '0') {
        dp[i][0] = dp[i - 1][0];
      } else if (s[i] == '1') {
        dp[i][0] = dp[i - 1][1];
      } else if (s[i] == '2') {
      }
    }
  }
  cout << (dp[len - 1][0] + dp[len - 1][1]) % 1000000007 << endl;
  return 0;
}
