// No.191212031920
#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;

inline void inc(int &x, const int &y) {
    x += y; if (x >= Mod) x -= Mod;
}

int nxt[7][2];
int n, f[7], g[7];
char s[300300];

int main() {
#ifdef LOCAL_JUDGE
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    scanf("%s", s + 1);
    n = strlen(s + 1);
    assert(n & 1);

    if (n == 1) puts(s[1] == '0' ? "0" : "1"), exit(0);

    nxt[0][0] = 1, nxt[0][1] = 3;
    nxt[1][0] = 2, nxt[1][1] = 0;
    nxt[2][0] = 1, nxt[2][1] = 1;
    nxt[3][0] = 4, nxt[3][1] = 6;
    nxt[4][0] = 5, nxt[4][1] = 3;
    nxt[5][0] = 4, nxt[5][1] = 4;
    nxt[6][0] = 6, nxt[6][1] = 6;

    f[0] = 1;
    for (int i = 1; i <= n; ++i) {
        memset(g, 0, sizeof g);
        for (int j = 0; j < 7; ++j) if (f[j]) {
            if (s[i] ^ '1') inc(g[nxt[j][0]], f[j]);
            if (s[i] ^ '0') inc(g[nxt[j][1]], f[j]);
        }
        swap(g, f);
    }

    cout << 1ll * (f[6] + f[3]) % Mod;

    return 0;
}
