#include <bits/stdc++.h>
unsigned long long dp[2][5];
void copy(unsigned long long dp[2][5]) {
  dp[0][0] = dp[1][0];
  dp[0][1] = dp[1][1];
  dp[0][2] = dp[1][2];
  dp[0][3] = dp[1][3];
  dp[0][4] = dp[1][4];
}
void already(unsigned long long dp[2][5], char letter, int i) {
  switch (letter) {
    case '0':
      dp[i][1] = 0;
      dp[i][2] = 0;
      dp[i][3] = 0;
      dp[i][4] = 0;
      break;
    case '1':
      dp[i][0] = 0;
      dp[i][3] = 0;
      dp[i][4] = 0;
      break;
    case '2':
      dp[i][0] = 0;
      dp[i][1] = 0;
      dp[i][2] = 0;
      dp[i][4] = 0;
      break;
    case '*':
      dp[i][0] = 0;
      dp[i][1] = 0;
      dp[i][2] = 0;
      dp[i][3] = 0;
      break;
  }
}
int main() {
  char string[1000000 + 1];
  int slen, i;
  scanf("%s", string);
  slen = strlen(string);
  dp[0][0] = 1;
  dp[0][1] = 0;
  dp[0][2] = 1;
  dp[0][3] = 0;
  dp[0][4] = 1;
  already(dp, string[0], 0);
  for (i = 1; i < slen; i++) {
    dp[1][0] = (dp[0][0] + dp[0][1]) % 1000000007;
    dp[1][1] = dp[0][4];
    dp[1][2] = (dp[0][0] + dp[0][1]) % 1000000007;
    dp[1][3] = dp[0][4];
    dp[1][4] = (dp[0][3] + dp[0][2] + dp[0][4]) % 1000000007;
    copy(dp);
    already(dp, string[i], 0);
  }
  printf("%I64d\n", (dp[0][0] + dp[0][1] + dp[0][4]) % 1000000007);
  return 0;
}
