#include <cstdio>
#include <cstring>
#include <algorithm>

const int Mod = 1000000007;
const int MN = 300005;

inline void Add(int &x, int y) { x -= (x += y) >= Mod ? Mod : 0; }

int N;
char S[MN];
int t0[7] = {2, 4, 0, 0, 6, 5, 4}, t1[7] = {3, 5, 0, 1, 1, 5, 4};
int f[7], g[7];

int main() {
	scanf("%s", S + 1), N = strlen(S + 1);
	f[0] = S[1] != '1', f[1] = S[1] != '0';
	for (int i = 2; i <= N; ++i) {
		for (int j = 0; j < 7; ++j) g[j] = 0;
		for (int j = 0; j < 7; ++j) {
			if (S[i] != '1') Add(g[t0[j]], f[j]);
			if (S[i] != '0') Add(g[t1[j]], f[j]);
		}
		std::swap(f, g);
	}
	printf("%d\n", (f[1] + f[5]) % Mod);
	return 0;
}