#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
const ll maxn = 300010,mod = 1e9+7;
ll n,turn[10][2],f[maxn][10],ans;
char s[maxn];

int main()
{
    scanf("%s",s + 1);
    n = strlen(s + 1);
    turn[0][1] = 1;
    turn[0][0] = 5;
    turn[1][1] = 2;
    turn[1][0] = 3;
    turn[2][1] = turn[2][0] = 2;
    turn[3][0] = 4;
    turn[3][1] = 1;
    turn[4][0] = turn[4][1] = 3;
    turn[5][0] = 6;
    turn[5][1] = 7;
    turn[6][0] = turn[6][1] = 5;
    turn[7][0] = 5;
    turn[7][1] = 1;
    f[0][0] = 1;
    for (ll i = 1; i <= n; i++)
        for (ll j = 0; j <= 7; j++)
            if (f[i - 1][j])
            {
                if (s[i] == '1' || s[i] == '?')
                    f[i][turn[j][1]] += f[i - 1][j];
                if (s[i] == '0' || s[i] == '?')
                    f[i][turn[j][0]] += f[i - 1][j];
                f[i][turn[j][1]] %= mod;
                f[i][turn[j][0]] %= mod;
            }
    ans = (f[n][1] + f[n][2]) % mod;
    printf("%lld\n",ans);

    return 0;
}
