#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
int f[1001001][2][3], N;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cin >> s;
  N = s.size();
  s = " " + s;
  f[0][0][0] = 1;
  for (int(n) = 1; (n) <= (N); (n)++)
    for (int(b) = 0; (b) < (2); (b)++)
      for (int(b2) = 0; (b2) < (2); (b2)++)
        for (int(t2) = 0; (t2) < (3); (t2)++) {
          if (b && '0' <= s[n] && s[n] <= '2') continue;
          if (!b && s[n] == '*') continue;
          if (b && t2 == 1) continue;
          if (!b && t2 == 2) continue;
          if (b2 && '0' <= s[n - 1] && s[n - 1] <= '2') continue;
          if (!b2 && s[n - 1] == '*') continue;
          if (b2 && s[n] == '0') continue;
          if (!b2 && s[n] == '2') continue;
          int t = 0;
          if (s[n] == '0') t = 1;
          if (s[n] == '1') t = b2 ? 1 : 2;
          if (s[n] == '2') t = 2;
          f[n][b][t] = (f[n - 1][b2][t2] + f[n][b][t]) % int(1e9 + 7);
        }
  int ans = 0;
  for (int(b) = 0; (b) < (2); (b)++)
    for (int(t) = 0; (t) < (2); (t)++) ans = (ans + f[N][b][t]) % int(1e9 + 7);
  cout << ans << '\n';
}
