#include<cstdio>
#include<cstring>
#define mod 1000000007
int a[8][2]={3,1,5,2,2,2,4,7,3,3,6,1,5,5,3,1};
int f[300100][8],n,i,j;
char S[300100];
int main(){
	scanf("%s",S);
	n=strlen(S);
	f[n][1]=f[n][2]=1;
	for(int i=n-1;i>=0;i--)
		for(int j=0;j<=7;j++){
	        if(S[i]!='0')f[i][j]+=f[i+1][a[j][1]];
	        if(S[i]!='1')f[i][j]+=f[i+1][a[j][0]];
	        f[i][j]%=mod;				
		}
	printf("%d\n",f[0][0]);
}