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