#include<bits/stdc++.h>
using namespace std;

const int _ = 3e5 + 7 , MOD = 1e9 + 7;
int N , dp[_][4][3]; char str[_];

int main(){
	scanf("%s" , str + 1); N = strlen(str + 1);
	dp[0][0][0] = 1;
	for(int i = 1 ; i <= N ; ++i){
		if(str[i] != '1')
			for(int j = 0 ; j <= 3 ; ++j)
				for(int k = 0 ; k < 3 ; ++k){
					if(dp[i - 1][j][k])
						dp[i][j][k == 2 ? 1 : k + 1] = (dp[i][j][k == 2 ? 1 : k + 1] + dp[i - 1][j][k]) % MOD;
				}
		if(str[i] != '0')
			for(int j = 0 ; j <= 3 ; ++j)
				for(int k = 0 ; k < 3 ; ++k)
					if(dp[i - 1][j][k])
						dp[i][min(j + (k == 0) , 3)][max(k - 1 , 0)] = (dp[i][min(j + (k == 0) , 3)][max(k - 1 , 0)] + dp[i - 1][j][k]) % MOD;
	}
	int sum = 0;
	for(int i = 0 ; i <= 3 ; ++i)
		for(int j = 0 ; j < i ; ++j)
			sum = (sum + dp[N][i][j]) % MOD;
	cout << sum; return 0;
}