//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 300010
#define mdn 1000000007
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
int f[N][3][4],n;
void upd(int &x,int y){x+=x+y>=mdn?y-mdn:y;}
char ch[N];
int main()
{
	scanf("%s",ch+1); n=strlen(ch+1); f[0][0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int z=0;z<3;z++)	for(int o=0;o<=3;o++)
		{
			int v=f[i-1][z][o];
			if(ch[i]!='0')
			{
				if(z)	upd(f[i][z-1][o],v);
				else	upd(f[i][z][min(o+1,3)],v);
			}
			if(ch[i]!='1')
				upd(f[i][z+1==3?1:z+1][o],v);
		}
	}
	int ans=0;
	for(int z=0;z<3;z++)	for(int o=z+1;o<=3;o++)
		upd(ans,f[n][z][o]);
	printf("%d\n",ans);
	return 0;
}