#include <cstdio>
#include <cstring>
#include <iostream>
#define MN 301000
#define mod 1000000007

int f[MN][2][4]; //?? 0? 00 01
char s[MN];
int cnt[MN];

void rw(int &a, int b) {a = (a + b) % mod;}

int main()
{
	scanf("%s", s);
	int len = strlen(s);
	cnt[len] = 1;
	for(int i = len - 1; i >= 0; i--) 
	{
		cnt[i] = cnt[i + 1];
		if(s[i] == '?') cnt[i] = 2 * cnt[i] % mod;
	}
	f[0][0][0] = 1;
	int ans = 0;
	for(int i = 0; i < len; i++)
	{
		for(int j = 0; j < 2; j++)
		{
			for(int k = 0; k < 4; k++)
			{
				if(s[i] == '0' || s[i] == '?')
				{
					if(k == 0 || k == 2 || k == 3) rw(f[i + 1][j][1], f[i][j][k]);
					if(k == 1) rw(f[i + 1][j][2], f[i][j][k]);
				}
				if(s[i] == '1' || s[i] == '?')
				{
					if(k == 0 || k == 3)
					{
						if(j == 1) rw(ans, 1ll * f[i][j][k] * cnt[i + 1] % mod);
						else rw(f[i + 1][j + 1][0], f[i][j][k]);
					}
					if(k == 1) rw(f[i + 1][j][3], f[i][j][k]);
					if(k == 2) rw(f[i + 1][j][1], f[i][j][k]);
				}
			}
		}
	}
	rw(ans, f[len][1][0]);
	rw(ans, f[len][1][3]);
	printf("%d\n", ans);
}

//如果知道 S，可以从左往右贪心，有1就留，否则凑足3个合并(最左边为0)，然后DP一下方案数 