#include <bits/stdc++.h>

const int N = 300000 + 233, P = 1e9 + 7;

inline void check(int &x) {
  x -= P, x += x < 0 ? P : 0;
}

int n, f[N][7]; char str[N];

int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  if (n == 1) {
    puts(str[1] == '0' ? "0" : "1");
    return 0;
  }
  if (str[1] != '1') f[1][0] = 1;
  if (str[1] != '0') f[1][1] = 1;
  for (int i = 1; i < n; ++i) {
    if (str[i + 1] != '1') {
      check(f[i + 1][0] += f[i][2]);
      check(f[i + 1][0] += f[i][3]);
      check(f[i + 1][2] += f[i][0]);
      check(f[i + 1][4] += f[i][1]);
      check(f[i + 1][5] += f[i][4]);
      check(f[i + 1][6] += f[i][6]);
      check(f[i + 1][4] += f[i][5]);
    }
    if (str[i + 1] != '0') {
      check(f[i + 1][0] += f[i][2]);
      check(f[i + 1][3] += f[i][0]);
      check(f[i + 1][1] += f[i][3]);
      check(f[i + 1][1] += f[i][4]);
      check(f[i + 1][4] += f[i][5]);
      check(f[i + 1][6] += f[i][1]);
      check(f[i + 1][6] += f[i][6]);
    }
  }
  std::cout << (f[n][1] + f[n][6]) % P << std::endl;
  return 0;
}

