#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
const int mod = 1000000007;
long long dp[2][5], ans;
int n;
string s;
long long Sum(long long x, long long y) { return (x + y) % mod; }
int main() {
  cin >> s;
  dp[0][0] = dp[0][1] = 1;
  for (int i = 1; i <= s.size(); i++) {
    int pos = i % 2;
    for (int j = 0; j < 5; j++) dp[pos][j] = 0;
    int last = 1 - pos;
    if (s[i - 1] == '0')
      dp[pos][0] = Sum(dp[last][0], dp[last][2]);
    else if (s[i - 1] == '1') {
      dp[pos][1] = Sum(dp[last][0], dp[last][2]);
      dp[pos][2] = dp[last][4];
    } else if (s[i - 1] == '2')
      dp[pos][3] = dp[last][4];
    else if (s[i - 1] == '*') {
      dp[pos][4] = Sum(dp[last][1], dp[last][3]);
      dp[pos][4] = Sum(dp[last][4], dp[pos][4]);
    } else {
      dp[pos][0] = Sum(dp[last][0], dp[last][2]);
      dp[pos][1] = Sum(dp[last][0], dp[last][2]);
      dp[pos][2] = dp[last][4];
      dp[pos][3] = dp[last][4];
      dp[pos][4] = Sum(dp[last][1], dp[last][3]);
      dp[pos][4] = Sum(dp[last][4], dp[pos][4]);
    }
  }
  int now = (int)s.size() % 2;
  ans = Sum(dp[now][0], dp[now][2]);
  ans = Sum(ans, dp[now][4]);
  cout << ans;
}
