#include <bits/stdc++.h>
using namespace std;
const int nax = 5e5 + 5;
char sl[nax];

const int _ = 0, _0 = 1, _1 = 2, _00 = 3, _01 = 4, _10 = 5, _100 = 6, WIN = 7;

int f(int a, int b) {
	if(a == _) {
		if(b == 0) return _0;
		return _1;
	}
	if(a == _0) {
		if(b == 0) return _00;
		return _01;
	}
	if(a == _1) {
		if(b == 0) return _10;
		return WIN;
	}
	if(a == _00) {
		if(b == 0) return _0;
		return _0;
	}
	if(a == _01) {
		if(b == 0) return _0;
		return _1;
	}
	if(a == _10) {
		if(b == 0) return _100;
		return _1;
	}
	if(a == _100) {
		if(b == 0) return _10;
		return _10;
	}
	assert(a == WIN);
	return WIN;
}

const int mod = 1e9 + 7;

int main() {
	scanf("%s", sl);
	int n = strlen(sl);
	vector<int> dp(8);
	dp[0] = 1;
	for(int where = 0; where < n; ++where) {
		vector<long long> nowe(8);
		for(int i = 0; i < 8; ++i) {
			if(sl[where] == '?' || sl[where] == '0')
				nowe[f(i, 0)] += dp[i];
			if(sl[where] == '?' || sl[where] == '1')
				nowe[f(i, 1)] += dp[i];
		}
		for(int i = 0; i < 8; ++i)
			dp[i] = nowe[i] % mod;
		//for(int i = 0; i < 8; ++i) printf("%d ", dp[i]); puts("");
	}
	printf("%d\n", (dp[WIN] + dp[_1]) % mod);
}