#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cstdlib>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int N=1e6+11,mod=1e9+7;
int go[8][2]={{2,1},{4,3},{6,5},{3,3},{7,1},{2,1},{2,2},{4,4}};
int f[N][9];
char s[N];
int n;
inline void inc(int &x,int y){
	x+=y;
	if(x>=mod)
		x-=mod;
}
int main(){
	f[0][0]=1;
	gets(s+1);
	n=strlen(s+1);
	rep(i,1,n){
		rep(j,0,8){
			if(s[i]!='0')
				inc(f[i][go[j][1]],f[i-1][j]);
			if(s[i]!='1')
				inc(f[i][go[j][0]],f[i-1][j]);
		}
	}
	printf("%d\n",(f[n][1]+f[n][3])%mod);
	return 0;
}