#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const double PI = 4*atan(1);
const ll INF = 1e18;
const int MX = 100001;

string S;
int num[300001][3][2][3]; // yes even, yes odd, current parity, current num

void ad(int& x, int y) {
    x = (x+y)%MOD;
}

void solve() {
    num[0][0][0][0] = 1;
    F0R(i,sz(S)) F0R(a,3) F0R(b,2) F0R(c,3) if (num[i][a][b][c]) {
        if (S[i] != '1') ad(num[i+1][a][b][c == 2 ? 1 : c+1],num[i][a][b][c]);
        if (S[i] != '0') {
            if (c == 0) {
                if (b == 0) ad(num[i+1][max(a,1)][b^1][0],num[i][a][b][c]);
                else ad(num[i+1][a>0?2:0][b^1][0],num[i][a][b][c]);
            } else if (c == 1) {
                ad(num[i+1][a][b][0],num[i][a][b][c]);
            } else {
                ad(num[i+1][a][b^1][0],num[i][a][b][c]);
            }
        }
    }
    int ans = 0;
    F0R(a,3) F0R(b,2) F0R(c,3) 
        if (a == 2 || (a == 1 && b == 1 && c == 0)) 
            ad(ans,num[sz(S)][a][b][c]);
            
    cout << ans << "\n";
}

string gen() {
    string t;
    F0R(i,5) {
        int k = rand();
        if (k % 3 == 0) t += '0';
        else if (k % 3 == 1) t += '1';
        else t += '?';
    }
    return t;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> S;
    solve();
}

// read the question correctly (is y a vowel?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec g(nmax);





void solve4ts()
{
    
    int N; cin >> N;
	cout << 0 << endl;
	string first; cin >> first;
 
	int l = 0, r = N;
	if(first!="Vacant")while (1) {
		int m = (l + r) / 2;
		cout << m << endl;
 
		string s; cin >> s;
		if (s == "Vacant")break;
		
		if (m % 2 && s != first || m % 2 == 0 && s == first)l = m + 1;
		else r = m;
	}
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}