#include <bits/stdc++.h>
using namespace std;
int FASTBUFFER;
int n, i, ans, f[1000005][5];
char str[1000005];
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  if (str[1] == '*')
    f[1][2] = 1;
  else if (str[1] == '1')
    f[1][1] = 1;
  else if (str[1] == '2') {
    printf("0\n");
    return 0;
  } else if (str[1] == '0')
    f[1][0] = 1;
  else
    f[1][1] = f[1][0] = f[1][2] = 1;
  for (i = 2; i <= n; i++) {
    if (str[i] == '*')
      f[i][2] = (f[i - 1][1] + f[i - 1][2]) % 1000000007;
    else if (str[i] == '0')
      f[i][0] = f[i - 1][0];
    else if (str[i] == '1') {
      f[i][1] = f[i - 1][0];
      f[i][0] = f[i - 1][2];
    } else if (str[i] == '2')
      f[i][1] = f[i - 1][2];
    else {
      f[i][2] = (f[i - 1][1] + f[i - 1][2]) % 1000000007;
      f[i][0] = (f[i - 1][0] + f[i - 1][2]) % 1000000007;
      f[i][1] = (f[i - 1][0] + f[i - 1][2]) % 1000000007;
    }
  }
  ans = (f[n][0] + f[n][2]) % 1000000007;
  printf("%d\n", ans);
  return 0;
}
