#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

string s;
LL n;
LL to0[7] = {2,4,0,0,6,5,4},to1[7] = {3,5,0,1,1,5,4}; 
LL dp[7][300005];

int main(){
	cin >> s; n = s.length(); s = ' ' + s;
	dp[0][1] = (s[1] != '1'); dp[1][1] = (s[1] != '0');
	for(LL i = 2;i <= n;i ++){
		for(LL j = 0;j < 7;j ++){
			if(s[i] != '0') dp[to1[j]][i] = (dp[to1[j]][i] + dp[j][i - 1]) % N;
			if(s[i] != '1') dp[to0[j]][i] = (dp[to0[j]][i] + dp[j][i - 1]) % N;
		}
	}
	cout << (dp[1][n] + dp[5][n]) % N << '\n';
	return 0;
}
//