#include <cstdio>
#include <cstring> 
#include <algorithm>
using namespace std;

const int MAXN = 300000;
const int MOD = int(1E9) + 7;

const int trans[2][8] = {
{1, 3, 5, 1, 1, 6, 5, 7},
{2, 4, 7, 1, 2, 2, 5, 7}
};

int f[2][8], n; char s[MAXN + 5];
int main() {
	scanf("%s", s), n = strlen(s);
	f[0][0] = 1;
	for(int i=0;i<n;i++) {
		for(int j=0;j<8;j++)
			f[1][j] = f[0][j], f[0][j] = 0;
		if( s[i] != '0' ) {
			for(int j=0;j<8;j++)
				f[0][trans[1][j]] = (f[0][trans[1][j]] + f[1][j]) % MOD;
		}
		if( s[i] != '1' ) {
			for(int j=0;j<8;j++)
				f[0][trans[0][j]] = (f[0][trans[0][j]] + f[1][j]) % MOD;
		}
	}
	printf("%d\n", (f[0][2] + f[0][7]) % MOD);
}