#include <bits/stdc++.h>
using namespace std;
string s;
int n;
long long zero[1000010], one[2][1000010], two[1000010], mine[1000010];
int main() {
  cin >> s;
  n = s.length();
  if (s[0] == '0' || s[0] == '?') zero[0] = 1;
  if (s[0] == '1' || s[0] == '?') one[1][0] = 1;
  if (s[0] == '*' || s[0] == '?') mine[0] = 1;
  for (int i = 1; i < n; i++) {
    if (s[i] == '0' || s[i] == '?')
      zero[i] = (zero[i - 1] + one[0][i - 1]) % 1000000007;
    if (s[i] == '2' || s[i] == '?') two[i] = mine[i - 1];
    if (s[i] == '*' || s[i] == '?')
      mine[i] = (mine[i - 1] + one[1][i - 1] + two[i - 1]) % 1000000007;
    if (s[i] == '1' || s[i] == '?') {
      one[0][i] = mine[i - 1];
      one[1][i] = (zero[i - 1] + one[0][i - 1]) % 1000000007;
    }
  }
  cout << (zero[n - 1] + one[0][n - 1] + mine[n - 1]) % 1000000007;
}
