#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
int main() {
  string s;
  cin >> s;
  long long int n = s.size();
  long long int dstar[n], dsecond[n], dfirst[n][2], dzero[n];
  for (long long int i = 0; i < n; i++) {
    dstar[i] = dsecond[i] = dzero[i] = 0;
    for (long long int j = 0; j < 2; j++) dfirst[i][j] = 0;
  }
  if (s[0] == '?')
    dstar[0] = dfirst[0][0] = dzero[0] = 1, dsecond[0] = dfirst[0][1] = 0;
  else if (s[0] == '*')
    dstar[0] = 1;
  else if (s[0] == '1')
    dfirst[0][0] = 1;
  else if (s[0] == '0')
    dzero[0] = 1;
  for (long long int i = 1; i < n; i++) {
    if (s[i] == '?') {
      dstar[i] = dstar[i - 1] + dfirst[i - 1][0] + dsecond[i - 1];
      dsecond[i] = dstar[i - 1];
      dzero[i] = dzero[i - 1] + dfirst[i - 1][1];
      dfirst[i][0] = dzero[i - 1] + dfirst[i - 1][1];
      dfirst[i][1] = dstar[i - 1];
    } else if (s[i] == '0')
      dzero[i] = dzero[i - 1] + dfirst[i - 1][1];
    else if (s[i] == '1') {
      dfirst[i][0] = dzero[i - 1] + dfirst[i - 1][1];
      dfirst[i][1] = dstar[i - 1];
    } else if (s[i] == '*')
      dstar[i] = dstar[i - 1] + dfirst[i - 1][0] + dsecond[i - 1];
    else
      dsecond[i] = dstar[i - 1];
    dstar[i] %= mod;
    dzero[i] %= mod;
    dfirst[i][0] %= mod;
    dfirst[i][1] %= mod;
    dsecond[i] %= mod;
  }
  long long int ans = dstar[n - 1] + dzero[n - 1] + dfirst[n - 1][1];
  ans %= mod;
  cout << ans << endl;
  return 0;
}
