#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 3;
char s[maxn];
int dp[maxn][5];
int main() {
  scanf("%s", s);
  size_t len = strlen(s);
  if (s[0] == '?')
    dp[0][0] = dp[0][1] = dp[0][4] = 1;
  else if (s[0] == '0')
    dp[0][0] = 1;
  else if (s[0] == '1')
    dp[0][1] = 1;
  else if (s[0] == '*')
    dp[0][4] = 1;
  for (int i = 1; i < len; ++i) {
    if (s[i] == '0')
      dp[i][0] = (dp[i - 1][0] + dp[i - 1][2]) % 1000000007;
    else if (s[i] == '1') {
      dp[i][1] = (dp[i - 1][0] + dp[i - 1][2]) % 1000000007;
      dp[i][2] = dp[i - 1][4] % 1000000007;
    } else if (s[i] == '2')
      dp[i][3] = dp[i - 1][4] % 1000000007;
    else if (s[i] == '*')
      dp[i][4] = ((dp[i - 1][1] + dp[i - 1][3]) % 1000000007 + dp[i - 1][4]) %
                 1000000007;
    else if (s[i] == '?') {
      dp[i][0] = (dp[i - 1][0] + dp[i - 1][2]) % 1000000007;
      dp[i][1] = (dp[i - 1][0] + dp[i - 1][2]) % 1000000007;
      dp[i][2] = dp[i - 1][4] % 1000000007;
      dp[i][3] = dp[i - 1][4] % 1000000007;
      dp[i][4] = ((dp[i - 1][1] + dp[i - 1][3]) % 1000000007 + dp[i - 1][4]) %
                 1000000007;
    }
  }
  printf("%d\n",
         ((dp[len - 1][0] + dp[len - 1][2]) % 1000000007 + dp[len - 1][4]) %
             1000000007);
  return 0;
}
