#include <iostream>
#include <vector>
#include <cmath>
#define int long long
using namespace std;

const double EPS = 0.00001;
const double INF = 1e9;
const int MOD = 1e6 + 3.;
const int N = 11;
int gauss(vector<vector<double>> a, vector<double> &ans, double p) {
    int lx = a[0].size() - 1;
    int ly = a.size();
    vector<int> where(lx, -1);

    for(int col = 0, row = 0;col != lx && row != ly;col++) {
        int sel = row;
        for(int i = row;i < ly;i++) {
            if(abs(a[sel][col]) < abs(a[i][col])) sel = i;
        }
        if(abs(a[sel][col]) < EPS) {
            continue;
        }
        for(int i = col;i <= lx;i++) {
            swap(a[row][i], a[sel][i]);
        }
        where[col] = row;

        for(int i = 0;i < ly;i++) {
            if(i != row) {
                double c = fmod(a[i][col] / a[row][col], p);
                for(int j = row;j <= lx;j++) {
                    a[i][j] = fmod(a[i][j] + p - fmod(a[row][j] * c, p), p);
                    a[i][j] = fmod(a[i][j], p);
                }
            }
        }
        row++;
    }

    for(int i = 0;i < ly;i++)
        for(int j = 0;j <= lx;j++)
            a[i][j] = fmod(round(a[i][j]), p);

    ans.assign(lx, 0);
    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) continue;
        ans[i] = fmod(a[where[i]][lx] / a[where[i]][i], p);
    }

    for(int i = 0;i < ly;i++) {
        double sum = 0.;
        for(int j = 0;j < lx;j++) {
            sum = fmod(sum + fmod(ans[j] * a[i][j], p) + p, p);
        }
        if(abs(sum - a[i][lx] ) > EPS) return 0;
    }

    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) return INF;
    }

    return 1;
}

int32_t main() {
    vector<vector<double>> v(N, vector<double>(12));
    vector<double> ans;
    cout << fixed;

    for(int i = 0;i < N;i++) {
        cout << "? " << i << endl;
        int x;
        cin >> x;
        int xst = 1;
        for(int j = 0;j < 11;j++) {
            v[i][j] = xst;
            xst = (xst * i) % MOD;
        }
        v[i][11] = x;
    }

    // for(int i = 0;i < N;i++) {
    //     for(int j = 0;j < 12;j++) {
    //         cout << v[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    int cans = gauss(v, ans, 1e6 + 3.);

    for(int i = 0;i < MOD;i++) {
        int tv = 1;
        int sum = 0;
        for(int j = 0;j < 11;j++) {
            sum = (sum + (tv * (int)ans[j]) % MOD) % MOD;
            tv = (tv * i) % MOD;
        }
        if(sum == 0) {
            cout << "! " << i;
            return 0;
        }
    }

    cout << "! -1";
    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

const double EPS = 0.00001;
const double INF = 1e9;
const int MOD = 1000003;

int gauss(vector<vector<double>> a, vector<double> &ans, double p) {
    int lx = a[0].size() - 1;
    int ly = a.size();
    vector<int> where(lx, -1);

    for(int col = 0, row = 0;col != lx && row != ly;col++) {
        int sel = row;
        for(int i = row;i < ly;i++) {
            if(abs(a[sel][col]) < abs(a[i][col])) sel = i;
        }
        if(abs(a[sel][col]) < EPS) {
            continue;
        }
        for(int i = col;i <= lx;i++) {
            swap(a[row][i], a[sel][i]);
        }
        where[col] = row;

        for(int i = 0;i < ly;i++) {
            if(i != row) {
                double c = a[i][col] / a[row][col];
                for(int j = row;j <= lx;j++)
                    a[i][j] = fmod(a[i][j] - fmod(a[row][j] * c, p) + p, p);
            }
        }
        row++;
    }

    // for(int i = 0;i < ly;i++) {
    //     for(int j = 0;j <= lx;j++) {
    //         cout << a[i][j] << ' ';
    //     }
    //     cout << '\n';
    // }

    ans.assign(lx, 0);
    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) continue;
        ans[i] = fmod(a[where[i]][lx] / a[where[i]][i], p);
    }

    for(int i = 0;i < ly;i++) {
        double sum = 0.;
        for(int j = 0;j < lx;j++) {
            sum = fmod(sum + fmod(ans[j] * a[i][j], p), p);
        }
        if(abs(sum - a[i][lx] ) > EPS) return 0;
    }

    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) return INF;
    }

    return 1;
}

int main() {
    vector<vector<double>> v(20, vector<double>(12));
    vector<double> ans;
    cout << fixed;

    for(int i = 0;i < 20;i++) {
        cout << "? " << i << endl;
        int x;
        cin >> x;
        int xst = 1;
        for(int j = 0;j < 11;j++) {
            v[i][j] = xst;
            xst = (xst * i) % MOD;
        }
        v[i][11] = x;
    }

    // for(int i = 0;i < 10;i++) {
    //     for(int j = 0;j < 12;j++) {
    //         cout << v[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    int cans = gauss(v, ans, MOD);
    if(cans != 0) {
        return -1;
    }

    for(int i = 0;i < MOD;i++) {
        int tv = 1;
        int sum = 0;
        for(int j = 0;j < 11;j++) {
            sum = (sum + (tv * (int)ans[j]) % MOD) % MOD;
            tv = (tv * i) % MOD;
        }
        if(sum == 0) {
            cout << "! " << i;
            return 0;
        }
    }

    cout << "! -1";
    return 0;
}


#include <iostream>
#include <vector>
#define int long long
using namespace std;

const int MOD = 1e6 + 3;

int mult(int a, int b) {
    return a * b % MOD;
}

int binpow(int a, int n) {
    if(n == 0) return 1;
    if(n % 2 == 1) return mult(binpow(a, n - 1), a);
    return binpow(mult(a, a), n / 2);
}

int inv(int a) {
    return binpow(a, MOD - 2);
}

int mdiv(int a, int b) {
    return mult(a, inv(b));
}

int normal(int a) {
    if(a >= MOD) a %= MOD;
    while(a < 0) {
        a += MOD;
    }
    return a;
}

int add(int a, int b) {
    return (a + b) % MOD;
}

int gauss(vector<vector<int>> m, vector<int> &ans) {
    int lx = m[0].size() - 1;
    int ly = m.size();

    for(int row = 0, col = 0;row < ly && col < lx;col++) {
        int sel = row;
        for(int i = row;i < ly;i++)
            if(m[sel][col] < m[i][col]) sel = i;
        for(int i = col;i <= lx;i++) {
            swap(m[sel][i], m[row][i]);
        }

        if(m[row][col] == 0) return 0;

        for(int i = 0;i < ly;i++) {
            if(i == row) continue;
            int c = mult(m[i][col], inv(m[row][col]));
            for(int j = col;j <= lx;j++) {
                m[i][j] = normal(m[i][j] - mult(m[row][j], c));
            }
        }
        row++;
    }

    ans.resize(ly);
    for(int i = 0;i < ly;i++) {
        ans[i] = mult(m[i][lx], inv(m[i][i]));
    }

    return 1;
}

int32_t main() {
    vector<vector<int>> v(11, vector<int>(12));
    for(int i = 0;i < 11;i++) {
        cout << "? " << i << endl;
        cin >> v[i][11];
        int x = 1;
        for(int j = 0;j < 11;j++) {
            v[i][j] = x;
            x = mult(x, i);
        }
    }

    vector<int> ans;
    gauss(v, ans);
    for(int i = 0;i < MOD;i++) {
        int x = 1;
        int sum = 0;
        for(int j = 0;j < ans.size();j++) {
            sum = add(sum, mult(x, ans[j]));
            x = mult(x, i);
        }
        if(sum == 0) {
            cout << "! " << i;
            return 0;
        }
    }
    cout << "! -1";

    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#define int long long
using namespace std;

const double EPS = 0.00001;
const double INF = 1e9;
const int MOD = 1e6 + 3.;
const int N = 50;
int gauss(vector<vector<double>> a, vector<double> &ans, double p) {
    int lx = a[0].size() - 1;
    int ly = a.size();
    vector<int> where(lx, -1);

    for(int col = 0, row = 0;col != lx && row != ly;col++) {
        int sel = row;
        for(int i = row;i < ly;i++) {
            if(abs(a[sel][col]) < abs(a[i][col])) sel = i;
        }
        if(abs(a[sel][col]) < EPS) {
            continue;
        }
        for(int i = col;i <= lx;i++) {
            swap(a[row][i], a[sel][i]);
        }
        where[col] = row;

        for(int i = 0;i < ly;i++) {
            if(i != row) {
                double c = fmod(a[i][col] / a[row][col], p);
                for(int j = row;j <= lx;j++) {
                    a[i][j] = fmod(a[i][j] + p - fmod(a[row][j] * c, p), p);
                    a[i][j] = fmod(a[i][j], p);
                }
            }
        }
        row++;
    }

    for(int i = 0;i < ly;i++)
        for(int j = 0;j <= lx;j++)
            a[i][j] = fmod(round(a[i][j]), p);

    ans.assign(lx, 0);
    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) continue;
        ans[i] = fmod(a[where[i]][lx] / a[where[i]][i], p);
    }

    for(int i = 0;i < ly;i++) {
        double sum = 0.;
        for(int j = 0;j < lx;j++) {
            sum = fmod(sum + fmod(ans[j] * a[i][j], p) + p, p);
        }
        if(abs(sum - a[i][lx] ) > EPS) return 0;
    }

    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) return INF;
    }

    return 1;
}

int32_t main() {
    vector<vector<double>> v(N, vector<double>(12));
    vector<double> ans;
    cout << fixed;

    for(int i = 0;i < N;i++) {
        cout << "? " << i * 20 << endl;
        int x;
        cin >> x;
        int xst = 1;
        for(int j = 0;j < 11;j++) {
            v[i][j] = xst;
            xst = (xst * i) % MOD;
        }
        v[i][11] = x;
    }

    // for(int i = 0;i < N;i++) {
    //     for(int j = 0;j < 12;j++) {
    //         cout << v[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    int cans = gauss(v, ans, 1e6 + 3.);

    for(int i = 0;i < MOD;i++) {
        int tv = 1;
        int sum = 0;

        for(int j = 0;j < 11;j++) {
            sum = (sum + (tv * (int)ans[j]) % MOD) % MOD;
            tv = (tv * i) % MOD;
        }
        if(sum == 0) {
            if(ans[0] == 2) return ans[1];
            cout << "! " << i;
            return 0;
        }
    }

    cout << "! -1";
    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#define int long long
using namespace std;

const double EPS = 0.00001;
const double INF = 1e9;
const int MOD = 1e6 + 3.;
const int N = 50;
int gauss(vector<vector<double>> a, vector<double> &ans, double p) {
    int lx = a[0].size() - 1;
    int ly = a.size();
    vector<int> where(lx, -1);

    for(int col = 0, row = 0;col != lx && row != ly;col++) {
        int sel = row;
        for(int i = row;i < ly;i++) {
            if(abs(a[sel][col]) < abs(a[i][col])) sel = i;
        }
        if(abs(a[sel][col]) < EPS) {
            continue;
        }
        for(int i = col;i <= lx;i++) {
            swap(a[row][i], a[sel][i]);
        }
        where[col] = row;

        for(int i = 0;i < ly;i++) {
            if(i != row) {
                double c = fmod(a[i][col] / a[row][col], p);
                for(int j = row;j <= lx;j++) {
                    a[i][j] = fmod(a[i][j] + p - fmod(a[row][j] * c, p), p);
                    a[i][j] = fmod(a[i][j], p);
                }
            }
        }
        row++;
    }

    for(int i = 0;i < ly;i++)
        for(int j = 0;j <= lx;j++)
            a[i][j] = fmod(round(a[i][j]), p);

    ans.assign(lx, 0);
    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) continue;
        ans[i] = fmod(a[where[i]][lx] / a[where[i]][i], p);
    }

    for(int i = 0;i < ly;i++) {
        double sum = 0.;
        for(int j = 0;j < lx;j++) {
            sum = fmod(sum + fmod(ans[j] * a[i][j], p) + p, p);
        }
        if(abs(sum - a[i][lx] ) > EPS) return 0;
    }

    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) return INF;
    }

    return 1;
}

int32_t main() {
    vector<vector<double>> v(N, vector<double>(12));
    vector<double> ans;
    cout << fixed;

    for(int i = 0;i < N;i++) {
        cout << "? " << i << endl;
        int x;
        cin >> x;
        int xst = 1;
        for(int j = 0;j < 11;j++) {
            v[i][j] = xst;
            xst = (xst * i) % MOD;
        }
        v[i][11] = x;
    }

    // for(int i = 0;i < N;i++) {
    //     for(int j = 0;j < 12;j++) {
    //         cout << v[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    int cans = gauss(v, ans, 1e6 + 3.);

    for(int i = 0;i < MOD;i++) {
        int tv = 1;
        int sum = 0;

        for(int j = 0;j < 11;j++) {
            sum = (sum + (tv * (int)ans[j]) % MOD) % MOD;
            tv = (tv * i) % MOD;
        }
        if(sum == 0) {
            cout << "! " << i;
            return 0;
        }
    }

    cout << "! -1";
    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#define int long long
using namespace std;

const double EPS = 0.00001;
const double INF = 1e9;
const int MOD = 1e6 + 3.;
const int N = 50;
int gauss(vector<vector<double>> a, vector<double> &ans, double p) {
    int lx = a[0].size() - 1;
    int ly = a.size();
    vector<int> where(lx, -1);

    for(int col = 0, row = 0;col != lx && row != ly;col++) {
        int sel = row;
        for(int i = row;i < ly;i++) {
            if(abs(a[sel][col]) < abs(a[i][col])) sel = i;
        }
        if(abs(a[sel][col]) < EPS) {
            continue;
        }
        for(int i = col;i <= lx;i++) {
            swap(a[row][i], a[sel][i]);
        }
        where[col] = row;

        for(int i = 0;i < ly;i++) {
            if(i != row) {
                double c = fmod(a[i][col] / a[row][col], p);
                for(int j = row;j <= lx;j++) {
                    a[i][j] = fmod(a[i][j] + p - fmod(a[row][j] * c, p), p);
                    a[i][j] = fmod(a[i][j], p);
                }
            }
        }
        row++;
    }

    for(int i = 0;i < ly;i++)
        for(int j = 0;j <= lx;j++)
            a[i][j] = fmod(round(a[i][j]), p);

    ans.assign(lx, 0);
    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) continue;
        ans[i] = fmod(a[where[i]][lx] / a[where[i]][i], p);
    }

    for(int i = 0;i < ly;i++) {
        double sum = 0.;
        for(int j = 0;j < lx;j++) {
            sum = fmod(sum + fmod(ans[j] * a[i][j], p) + p, p);
        }
        if(abs(sum - a[i][lx] ) > EPS) return 0;
    }

    for(int i = 0;i < lx;i++) {
        if(where[i] == -1) return INF;
    }

    return 1;
}

int32_t main() {
    vector<vector<double>> v(N, vector<double>(12));
    vector<double> ans;
    cout << fixed;

    for(int i = 0;i < N;i++) {
        cout << "? " << i << endl;
        int x;
        cin >> x;
        int xst = 1;
        for(int j = 0;j < 11;j++) {
            v[i][j] = xst;
            xst = (xst * i) % MOD;
        }
        v[i][11] = x;
    }

    // for(int i = 0;i < N;i++) {
    //     for(int j = 0;j < 12;j++) {
    //         cout << v[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    int cans = gauss(v, ans, 1e6 + 3.);

    for(int i = 0;i < MOD;i++) {
        int tv = 1;
        int sum = 0;

        for(int j = 0;j < 11;j++) {
            sum = (sum + (tv * (int)ans[j]) % MOD) % MOD;
            tv = (tv * i) % MOD;
        }
        if(sum == 0) {
            if(ans[0] == 2) return i;
            cout << "! " << i;
            return 0;
        }
    }

    cout << "! -1";
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	return (a%b + b)%b;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        l = (1ll * inv[de[i]] * l) % OO;
        ret += (1ll * l * y[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(1ll * de[i] * (i - j), OO);
        }
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
		a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        ret += (1ll * l * MOD((1ll * y[i] * de[i]) , OO)) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(1ll * de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
ll inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
ll f(ll x)
{
    printf("? %lld\n", x);
    fflush(stdout);
    scanf("%lld", &x);
    return x;
}
ll F(int x)
{
    ll ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        ll l = y[i];
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(l * (x - j), OO);
            }
        ret = (ret + l * de[i]) % OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
		a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        ret += (1ll * l * ((y[i] * de[i]) % OO)) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(1ll * de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
ll inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	return (a%b + b)%b;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
ll f(ll x)
{
    printf("? %lld\n", x);
    fflush(stdout);
    scanf("%lld", &x);
    return x;
}
ll F(int x)
{
    ll ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        ll l = y[i];
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(l * (x - j), OO);
            }
        ret = (ret + l * de[i]) % OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
		a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        ret += (1ll * l * MOD((y[i] * de[i]) , OO)) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(1ll * de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
		a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        int li = de[i];
        l = (1ll * inv[li] * l) % OO;
        ret += (1ll * l * y[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
       de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	return (a%b + b)%b;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        int li = 1;
        for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            li = MOD(1ll * li * (i - j), OO);
        }
        l = (1ll * inv[li] * l) % OO;
        ret += (1ll * l * y[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
		a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        int li = de[i];
        l = (1ll * li * l) % OO;
        ret += (1ll * l * y[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
       de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
ll inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	return (a%b + b)%b;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
ll f(ll x)
{
    printf("? %lld\n", x);
    fflush(stdout);
    scanf("%lld", &x);
    return x;
}
ll F(int x)
{
    ll ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        ll l = y[i];
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(l * (x - j), OO);
            }
        ret += (l * de[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	return (a%b + b)%b;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        ret += (1ll * l * ((y[i] * de[i]) % OO)) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(1ll * de[i] * (i - j), OO);
            de[i] = inv[de[i]];
        }
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	return (a%b + b)%b;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = y[i];
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        ret += (1ll * l * de[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(1ll * de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
		a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        int li = 1;
        for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            li = MOD(1ll * li * (i - j), OO);
        }
        l = (1ll * inv[li] * l) % OO;
        ret += (1ll * l * y[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
	return (a%b + b)%b;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        ret += (1ll * l * ((y[i] * de[i]) % OO)) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
    de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(1ll * de[i] * (i - j), OO);
        }
        de[i] = inv[de[i]];
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 +15, OO = 1e6 + 3;
int n, q, t1, t2;
int inv[N], y[15], de[15];
//Handle Negative MOD
ll MOD(ll a, ll b){
		a %= b;
	if(a < 0) a += b;
	return a;
}
void rangeInv(ll m)
{
    inv[1] = 1;
for(ll i = 2; i < m; ++i)
    inv[i] = (m - (m/i) * inv[m%i] % m) % m;
}
int f(int x)
{
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}
int F(int x)
{
    int ret = 0;
    for(int i = 0; i < 11; ++i)
    {
        int l = 1;
        for(int j = 0; j < 11; ++j)
            {
                if(j == i) continue;
                l = MOD(1ll * l * (x - j), OO);
            }
        int li = de[i];
        l = (1ll * inv[li] * l) % OO;
        ret += (1ll * l * y[i]) % OO;
        if(ret >= OO) ret -= OO;
    }
    return ret;
}
int main()
{
    rangeInv(OO);
for(int i = 0; i < 11; ++i)
{
    y[i] = f(i);
       de[i] = 1;
      for(int j = 0; j < 11; ++j)
        {
            if(j == i) continue;
            de[i] = MOD(de[i] * (i - j), OO);
        }
}
for(int i = 0; i <= OO; ++i)
{
    if(F(i) == 0)
    {
        printf("! %d\n", i);
        fflush(stdout);
        return 0;
    }
}
        printf("! -1\n");
        fflush(stdout);
}


//BISMILLAHIR RAHMANIR RAHIM
#include<bits/stdc++.h>

//Solution Idea
//
using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair <pii , int> piii;
typedef pair<ll, int > pdi;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef pair < ll , pll > plll;
typedef pair < pll , pll > pllll;

#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define mx 100005
#define mx1 100005
#define mx2 200005
#define mx3 300005
#define WHITE 0
#define RED 1
#define BLACK 2

#define bp __builtin_popcountll
#define fraction() cout.unsetf(ios::floatfield); cout.precision(20); cout.setf(ios::fixed,ios::floatfield);
#define hi cout<<"Dhukse " << endl;
#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

const ll PI = acos(-1);
const ll eps = 1e-12;
const int inf = 2000000000;
const ll infLL = (ll)1e18;
ll MOD =  1e6+3;
int MOD1 = 1000000007;
int MOD2 = 1000000009;

#define harmonic(n) 0.57721566490153286l(Eulers-Mascharoni constant)+log(n) ( 1/1 + 1/2 + .... + 1/n );

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, ll i) { return n&(1LL<<i); }
inline ll setBit(ll n, ll i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, ll i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(ll a, ll b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1LL; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modDiv(ll a, ll b) { return modMul(a, modPow(b, MOD-2)); }

bool comp( const pair < ll , pll > &p1 , const pair < ll , pll > &p2 ){ return p1.F > p2.F ;}
bool comp1( const pll &p1 , const pll &p2 ){
          if( p1.F == p2.F ){
                 return p1.S > p2.S;
          }
          return p1.F < p2.F ;
}
ll converter( string a ){
    ll i , mul = 1LL , r , t ,ans = 0LL;if( a.length() == 0 )return 0;for( i = a.length() - 1 ; i >= 0 ; i-- ){
        t = a[i] - '0';r = t%10;ans += (mul*r);mul = mul*10;
    }
    return ans;
}
int msb(unsigned x) {
    union { ll a; int b[2]; };
    a = x;
    return (b[1] >> 20) - 1023;
}

//
//debug
#ifndef ONLINE_JUDGE
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                        return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
const int MAX = 300005;

vector<ll> gauss(vector< vector<ll> > A) {
    int n = A.size();

    for (int i=0; i<n; i++) {
        // Search for maximum in this column
        ll maxEl = abs(A[i][i]);
        int maxRow = i;
        for (int k=i+1; k<n; k++) {
            if (abs(A[k][i]) > maxEl) {
                maxEl = abs(A[k][i]);
                maxRow = k;
            }
        }
        // Swap maximum row with current row (column by column)
        for (int k=i; k<n+1;k++) {
            ll tmp = A[maxRow][k];
            A[maxRow][k] = A[i][k];
            A[i][k] = tmp;
        }

        // Make all rows below this one 0 in current column
        for (int k=i+1; k<n; k++) {
            ll c = modDiv(A[k][i],A[i][i])*(-1);
            c = (c + MOD) % MOD;
            for (int j=i; j<n+1; j++) {
                if (i==j) {
                    A[k][j] = 0;
                } else {
                    A[k][j] += modMul(c , A[i][j]);
                    A[k][j] += MOD;
                    A[k][j] %= MOD;
                }
            }
        }
    }

    // Solve equation Ax=b for an upper triangular matrix A
    vector<ll> x(n);
    for (int i=n-1; i>=0; i--) {
        x[i] = modDiv(A[i][n],A[i][i]);
        for (int k=i-1;k>=0; k--) {
            A[k][n] = modSub( A[k][n] , modMul(A[k][i] , x[i]));
        }
    }
    return x;
}

int main() {
    optimize();
    fraction();

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin) ;
    freopen("output.txt","w",stdout);
     #endif

    ll n , i , j , cur;

    n = 11;

        vector<ll> line(n+1,0);
        vector< vector<ll> > A(n,line);

        for(i = 0 ; i < n ; ++i){
            cur = 1;
            cout << "? " << i << endl;
            cout.flush();
            ll res ;
            cin >> res;
            for(j = 0 ; j < n; ++j){
                A[i][j] = cur;
                cur = (cur*(i))%MOD;
            }
            A[i][n] = res;
        }

        vector<ll> ans = gauss(A);

        for(i = 1 ; i < MOD ; ++i){
            ll sum = 0LL;
            cur = 1;
            for(j = 0 ; j < n ; ++j){
                cur = modMul(ans[j] ,cur);
                sum = modAdd(sum ,cur);
                cur = (cur*i)%MOD;
            }
            if(sum == 0){
                cout << "! " << i << endl;
                cout.flush();
                exit(0);
            }
        }
        cout << "! -1" << endl;
        cout.flush();

    return 0;
}


#include<bits/stdc++.h>
#define long long long
using namespace std;
const long N=1e6;
const long mod=1e6+3;

//
//debug
#ifndef ONLINE_JUDGE
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                        return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif

long bigmod(long b,long p,long mod)
{
  long ret=1LL;
  while(p)
  {
    if(p%2)ret=(ret*b)%mod;
    b=(b*b)%mod;p/=2;
  }
  return ret;
}
long inv(long x)
{
  return bigmod(x,mod-2,mod);
}
void gauss(vector<vector<long>>a,vector<long>&x)
{
  long n=a.size(),m=a[0].size()-1;
  vector<long>wh(m,-1);
  for(long col=0,row=0;col<m&&row<n;col++)
  {
    long swp=-1;
    for(long i=row;i<n;i++)
    {
      if(a[i][col])
      {
        swp=i;break;
      }
    }
    if(swp==-1)continue;
    for(long i=col;i<=m;i++)swap(a[row][i],a[swp][i]);
    wh[col]=row;
    for(long i=0;i<n;i++)
    {
      if(i==row)continue;
      long c=(a[i][col]*inv(a[row][col]))%mod;
      for(long j=0;j<=m;j++)
        a[i][j]=(a[i][j]-(a[row][j]*c)%mod+mod)%mod;
    }
    row++;
  }
  x.assign(m,0);
  for(long i=0;i<m;i++)
  {
    if(wh[i]==-1)continue;
    x[i]=(a[wh[i]][m]*inv(a[wh[i]][i]))%mod;
  }
}
long eval(long x,vector<long>ans)
{
  long p=1,sum=0;
  for(long i=0;i<=10;i++)
  {
    sum=(sum+p*ans[i])%mod;
    p=(p*x)%mod;
  }
  return sum;
}
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin) ;
    freopen("output.txt","w",stdout);
     #endif
  ios_base::sync_with_stdio(0);cin.tie(0);
  vector<vector<long> >a;vector<long>ans,v;
  for(long i=0;i<=10;i++)
  {
    v.clear();long p=1;
    for(long j=0;j<=10;j++)
    {
      v.push_back(p);p=(p*i)%mod;
    }
    cout<<"? "<<i<<endl;
    cout.flush();
    long x;
    cin>>x;v.push_back(x);
    a.push_back(v);
  }
  gauss(a,ans);
  for(long i=0;i<mod;i++)
  {
    if(!eval(i,ans))cout<<"! "<<i<<endl,exit(0);
  }
  cout<<"! "<<-1<<endl;
  cout.flush();
  return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include<bits/stdc++.h>

//Solution Idea
//
using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair <pii , int> piii;
typedef pair<ll, int > pdi;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef pair < ll , pll > plll;
typedef pair < pll , pll > pllll;

#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define mx 100005
#define mx1 100005
#define mx2 200005
#define mx3 300005
#define WHITE 0
#define RED 1
#define BLACK 2

#define bp __builtin_popcountll
#define fraction() cout.unsetf(ios::floatfield); cout.precision(20); cout.setf(ios::fixed,ios::floatfield);
#define hi cout<<"Dhukse " << endl;
#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

const ll PI = acos(-1);
const ll eps = 1e-12;
const int inf = 2000000000;
const ll infLL = (ll)1e18;
ll MOD =  1e6+3;
int MOD1 = 1000000007;
int MOD2 = 1000000009;

#define harmonic(n) 0.57721566490153286l(Eulers-Mascharoni constant)+log(n) ( 1/1 + 1/2 + .... + 1/n );

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, ll i) { return n&(1LL<<i); }
inline ll setBit(ll n, ll i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, ll i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(ll a, ll b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1LL; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modDiv(ll a, ll b) { return modMul(a, modPow(b, MOD-2)); }

bool comp( const pair < ll , pll > &p1 , const pair < ll , pll > &p2 ){ return p1.F > p2.F ;}
bool comp1( const pll &p1 , const pll &p2 ){
          if( p1.F == p2.F ){
                 return p1.S > p2.S;
          }
          return p1.F < p2.F ;
}
ll converter( string a ){
    ll i , mul = 1LL , r , t ,ans = 0LL;if( a.length() == 0 )return 0;for( i = a.length() - 1 ; i >= 0 ; i-- ){
        t = a[i] - '0';r = t%10;ans += (mul*r);mul = mul*10;
    }
    return ans;
}
int msb(unsigned x) {
    union { ll a; int b[2]; };
    a = x;
    return (b[1] >> 20) - 1023;
}

//
//debug
#ifndef ONLINE_JUDGE
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                        return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
const int MAX = 300005;

vector<ll> gauss(vector< vector<ll> > A) {
    int n = A.size();

    for (int i=0; i<n; i++) {
        // Search for maximum in this column
        ll maxEl = abs(A[i][i]);
        int maxRow = i;
        for (int k=i+1; k<n; k++) {
            if (abs(A[k][i]) > maxEl) {
                maxEl = abs(A[k][i]);
                maxRow = k;
            }
        }
        // Swap maximum row with current row (column by column)
        for (int k=i; k<n+1;k++) {
            ll tmp = A[maxRow][k];
            A[maxRow][k] = A[i][k];
            A[i][k] = tmp;
        }

        // Make all rows below this one 0 in current column
        for (int k=i+1; k<n; k++) {
            ll c = modDiv(A[k][i],A[i][i])*(-1);
            c = (c + MOD) % MOD;
            for (int j=i; j<n+1; j++) {
                if (i==j) {
                    A[k][j] = 0;
                } else {
                    A[k][j] += modMul(c , A[i][j]);
                    A[k][j] += MOD;
                    A[k][j] %= MOD;
                }
            }
        }
    }

    // Solve equation Ax=b for an upper triangular matrix A
    vector<ll> x(n);
    for (int i=n-1; i>=0; i--) {
        x[i] = modDiv(A[i][n],A[i][i]);
        for (int k=i-1;k>=0; k--) {
            A[k][n] = modSub( A[k][n] , modMul(A[k][i] , x[i]));
        }
    }
    return x;
}

int main() {
    optimize();
    fraction();

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin) ;
    freopen("output.txt","w",stdout);
     #endif

    ll n , i , j , cur;

    n = 11;

        vector<ll> line(n+1,0);
        vector< vector<ll> > A(n,line);

        for(i = 0 ; i < n ; ++i){
            cur = 1;
            cout << "? " << i << endl;
            cout.flush();
            ll res ;
            cin >> res;
            A[i][j] = cur;
            cur = (cur*(i))%MOD;
            A[i][n] = res;
        }

        vector<ll> ans = gauss(A);

        for(i = 1 ; i < MOD ; ++i){
            ll sum = 0LL;
            cur = 1;
            for(j = 0 ; j < n ; ++j){
                cur = modMul(ans[j] ,cur);
                sum = modAdd(sum ,cur);
                cur = (cur*i)%MOD;
            }
            if(sum == 0){
                cout << "! " << i << endl;
                cout.flush();
                exit(0);
            }
        }
        cout << "! -1" << endl;
        cout.flush();

    return 0;
}


#include<bits/stdc++.h>
#define long long long
using namespace std;
const long N=1e6;
const long mod=1e6+3;

//
//debug
#ifndef ONLINE_JUDGE
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                        return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif

long bigmod(long b,long p,long mod)
{
  long ret=1LL;
  while(p)
  {
    if(p%2)ret=(ret*b)%mod;
    b=(b*b)%mod;p/=2;
  }
  return ret;
}
long inv(long x)
{
  return bigmod(x,mod-2,mod);
}
void gauss(vector<vector<long>>a,vector<long>&ans)
{
  long n=a.size(),m=a[0].size()-1;
  vector<long>wh(m,-1);
  for(long col=0,row=0;col<m&&row<n;col++)
  {
    long swp=-1;
    for(long i=row;i<n;i++)
    {
      if(a[i][col])
      {
        swp=i;break;
      }
    }
    if(swp==-1)continue;
    for(long i=col;i<=m;i++)swap(a[row][i],a[swp][i]);
    wh[col]=row;
    for(long i=0;i<n;i++)
    {
      if(i==row)continue;
      long c=(a[i][col]*inv(a[row][col]))%mod;
      for(long j=0;j<=m;j++)
        a[i][j]=(a[i][j]-(a[row][j]*c)%mod+mod)%mod;
    }
    row++;
  }
  ans.assign(m,0);
  for(long i=0;i<m;i++)
  {
    if(wh[i]==-1)continue;
    ans[i]=(a[wh[i]][m]*inv(a[wh[i]][i]))%mod;
  }
}
long eval(long x,vector<long>ans)
{
  long p=1,sum=0;
  for(long i=0;i<=10;i++)
  {
    sum=(sum+p*ans[i])%mod;
    p=(p*x)%mod;
  }
  return sum;
}
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin) ;
    freopen("output.txt","w",stdout);
     #endif
  ios_base::sync_with_stdio(0);cin.tie(0);
  vector<vector<long> >a;vector<long>ans,v;
  for(long i=0;i<=10;i++)
  {
    v.clear();long p=1;
    for(long j=0;j<=10;j++)
    {
      v.push_back(p);p=(p*i)%mod;
    }
    cout<<"? "<<i<<endl;long x;
    cin>>x;v.push_back(x);
    a.push_back(v);
  }
  gauss(a,ans);
  for(long i=0;i<mod;i++)
  {
    if(!eval(i,ans))cout<<"! "<<i<<endl,exit(0);
  }
  cout<<"! "<<-1<<endl;
  return 0;
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const long N=1e6;
const long mod=1e6+3;

const ll PI = acos(-1);
const ll eps = 1e-12;
const int inf = 2000000000;
const ll infLL = (ll)1e18;
ll MOD =  1e6+3;
int MOD1 = 1000000007;
int MOD2 = 1000000009;

#define harmonic(n) 0.57721566490153286l(Eulers-Mascharoni constant)+log(n) ( 1/1 + 1/2 + .... + 1/n );

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, ll i) { return n&(1LL<<i); }
inline ll setBit(ll n, ll i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, ll i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(ll a, ll b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1LL; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modDiv(ll a, ll b) { return modMul(a, modPow(b, MOD-2)); }

//
//debug
#ifndef ONLINE_JUDGE
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                        return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif

void gauss(vector< vector<ll> > A , vector<ll>&x ) {
    int n = A.size();

    for (int i=0; i<n; i++) {
        // Search for maximum in this column
        ll maxEl = abs(A[i][i]);
        int maxRow = i;
        for (int k=i+1; k<n; k++) {
            if (abs(A[k][i]) > maxEl) {
                maxEl = abs(A[k][i]);
                maxRow = k;
            }
        }
        // Swap maximum row with current row (column by column)
        for (int k=i; k<n+1;k++) {
            ll tmp = A[maxRow][k];
            A[maxRow][k] = A[i][k];
            A[i][k] = tmp;
        }

        // Make all rows below this one 0 in current column
        for (int k=i+1; k<n; k++) {
            ll c = modDiv(A[k][i],A[i][i])*(-1);
            c = (c + MOD) % MOD;
            for (int j=i; j<n+1; j++) {
                if (i==j) {
                    A[k][j] = 0;
                } else {
                    A[k][j] += modMul(c , A[i][j]);
                    A[k][j] += MOD;
                    A[k][j] %= MOD;
                }
            }
        }
    }

    // Solve equation Ax=b for an upper triangular matrix A
    //vector<ll> x(n);
    x.resize(n);
    for (int i=n-1; i>=0; i--) {
        x[i] = modDiv(A[i][n],A[i][i]);
        for (int k=i-1;k>=0; k--) {
            A[k][n] = modSub( A[k][n] , modMul(A[k][i] , x[i]));
        }
    }
}
ll eval(ll x,vector<ll>ans){
  ll p=1,sum=0;
  for(ll i=0;i<=10;i++)
  {
    sum=(sum+p*ans[i])%mod;
    p=(p*x)%mod;
  }
  return sum;
}

int main() {
    optimize();

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin) ;
    freopen("output.txt","w",stdout);
     #endif

    ll n , i , j , cur;
    n = 11;
        vector<ll> line(n+1,0);
        vector< vector<ll> > A(n,line);

        for(i = 0 ; i < n ; ++i){
            cur = 1;
            cout << "? " << i << endl;
            cout.flush();
            ll val ;
            cin >> val;
            for(j = 0 ; j < n; ++j){
                A[i][j] = cur;
                cur = (cur*(i))%MOD;
            }
            A[i][n] = val;
        }

        vector<ll> ans;
        gauss(A,ans);

        for(i = 0 ; i < MOD ; ++i){
            ll sum = 0LL;
            cur = 1;
            for(j = 0 ; j < n ; ++j){
                ll now = modMul(ans[j] ,cur);
                sum = modAdd(sum ,now);
                cur = (cur*i)%MOD;
            }
            if(sum == 0){
                cout << "! " << i << endl;
                cout.flush();
                exit(0);
            }
        }
        cout << "! -1" << endl;
        cout.flush();

    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const long N=1e6;
const long mod=1e6+3;

const ll PI = acos(-1);
const ll eps = 1e-12;
const int inf = 2000000000;
const ll infLL = (ll)1e18;
ll MOD =  1e6+3;
int MOD1 = 1000000007;
int MOD2 = 1000000009;

#define harmonic(n) 0.57721566490153286l(Eulers-Mascharoni constant)+log(n) ( 1/1 + 1/2 + .... + 1/n );

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, ll i) { return n&(1LL<<i); }
inline ll setBit(ll n, ll i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, ll i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(ll a, ll b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1LL; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modDiv(ll a, ll b) { return modMul(a, modPow(b, MOD-2)); }

//
//debug
#ifndef ONLINE_JUDGE
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                        return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif

void gauss(vector< vector<ll> > A , vector<ll>&x ) {
    int n = A.size();

    for (int i=0; i<n; i++) {
        // Search for maximum in this column
        ll maxEl = abs(A[i][i]);
        int maxRow = i;
        for (int k=i+1; k<n; k++) {
            if (abs(A[k][i]) > maxEl) {
                maxEl = abs(A[k][i]);
                maxRow = k;
            }
        }
        // Swap maximum row with current row (column by column)
        for (int k=i; k<n+1;k++) {
            ll tmp = A[maxRow][k];
            A[maxRow][k] = A[i][k];
            A[i][k] = tmp;
        }

        // Make all rows below this one 0 in current column
        for (int k=i+1; k<n; k++) {
            ll c = modDiv(A[k][i],A[i][i])*(-1);
            c = (c + MOD) % MOD;
            for (int j=i; j<n+1; j++) {
                if (i==j) {
                    A[k][j] = 0;
                } else {
                    A[k][j] += modMul(c , A[i][j]);
                    A[k][j] += MOD;
                    A[k][j] %= MOD;
                }
            }
        }
    }

    // Solve equation Ax=b for an upper triangular matrix A
    //vector<ll> x(n);
    x.resize(n);
    for (int i=n-1; i>=0; i--) {
        x[i] = modDiv(A[i][n],A[i][i]);
        for (int k=i-1;k>=0; k--) {
            A[k][n] = modSub( A[k][n] , modMul(A[k][i] , x[i]));
        }
    }
}
ll eval(ll x,vector<ll>ans){
  ll p=1,sum=0;
  for(ll i=0;i<=10;i++)
  {
    sum=(sum+p*ans[i])%mod;
    p=(p*x)%mod;
  }
  return sum;
}
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin) ;
    freopen("output.txt","w",stdout);
     #endif
  ios_base::sync_with_stdio(0);cin.tie(0);

  vector<vector<ll> >a;vector<ll>ans,v;
  for(ll i=0;i<=10;i++)
  {
    v.clear();ll p=1;
    for(ll j=0;j<=10;j++)
    {
      v.push_back(p);p=(p*i)%mod;
    }
    cout<<"? "<<i<<endl;ll x;
    cin>>x;v.push_back(x);
    a.push_back(v);
  }
  gauss(a,ans);
  for(ll i=0;i<mod;i++){
    if(!eval(i,ans))cout<<"! "<<i<<endl,exit(0);
  }
  cout<<"! "<<-1<<endl;
  return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include<bits/stdc++.h>

//Solution Idea
//
using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair <pii , int> piii;
typedef pair<ll, int > pdi;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef pair < ll , pll > plll;
typedef pair < pll , pll > pllll;

#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define mx 100005
#define mx1 100005
#define mx2 200005
#define mx3 300005
#define WHITE 0
#define RED 1
#define BLACK 2

#define bp __builtin_popcountll
#define fraction() cout.unsetf(ios::floatfield); cout.precision(20); cout.setf(ios::fixed,ios::floatfield);
#define hi cout<<"Dhukse " << endl;
#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

const ll PI = acos(-1);
const ll eps = 1e-12;
const int inf = 2000000000;
const ll infLL = (ll)1e18;
ll MOD =  1e6+3;
int MOD1 = 1000000007;
int MOD2 = 1000000009;

#define harmonic(n) 0.57721566490153286l(Eulers-Mascharoni constant)+log(n) ( 1/1 + 1/2 + .... + 1/n );

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, ll i) { return n&(1LL<<i); }
inline ll setBit(ll n, ll i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, ll i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(ll a, ll b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1LL; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modDiv(ll a, ll b) { return modMul(a, modPow(b, MOD-2)); }

bool comp( const pair < ll , pll > &p1 , const pair < ll , pll > &p2 ){ return p1.F > p2.F ;}
bool comp1( const pll &p1 , const pll &p2 ){
          if( p1.F == p2.F ){
                 return p1.S > p2.S;
          }
          return p1.F < p2.F ;
}
ll converter( string a ){
    ll i , mul = 1LL , r , t ,ans = 0LL;if( a.length() == 0 )return 0;for( i = a.length() - 1 ; i >= 0 ; i-- ){
        t = a[i] - '0';r = t%10;ans += (mul*r);mul = mul*10;
    }
    return ans;
}
int msb(unsigned x) {
    union { ll a; int b[2]; };
    a = x;
    return (b[1] >> 20) - 1023;
}

//
//debug
#ifndef ONLINE_JUDGE
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                        return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
const int MAX = 300005;
/*
vector<ll> gauss(vector< vector<ll> > A) {
    int n = A.size();

    for (int i=0; i<n; i++) {
        // Search for maximum in this column
        ll maxEl = abs(A[i][i]);
        int maxRow = i;
        for (int k=i+1; k<n; k++) {
            if (abs(A[k][i]) > maxEl) {
                maxEl = abs(A[k][i]);
                maxRow = k;
            }
        }
        // Swap maximum row with current row (column by column)
        for (int k=i; k<n+1;k++) {
            ll tmp = A[maxRow][k];
            A[maxRow][k] = A[i][k];
            A[i][k] = tmp;
        }

        // Make all rows below this one 0 in current column
        for (int k=i+1; k<n; k++) {
            ll c = modDiv(A[k][i],A[i][i])*(-1);
            c = (c + MOD) % MOD;
            for (int j=i; j<n+1; j++) {
                if (i==j) {
                    A[k][j] = 0;
                } else {
                    A[k][j] += modMul(c , A[i][j]);
                    A[k][j] += MOD;
                    A[k][j] %= MOD;
                }
            }
        }
    }

    // Solve equation Ax=b for an upper triangular matrix A
    vector<ll> x(n);
    for (int i=n-1; i>=0; i--) {
        x[i] = modDiv(A[i][n],A[i][i]);
        for (int k=i-1;k>=0; k--) {
            A[k][n] = modSub( A[k][n] , modMul(A[k][i] , x[i]));
        }
    }
    return x;
}

*/

const int mod = MOD;

long bigmod(long b,long p,long mod)
{
  long ret=1LL;
  while(p)
  {
    if(p%2)ret=(ret*b)%mod;
    b=(b*b)%mod;p/=2;
  }
  return ret;
}
long inv(long x)
{
  return bigmod(x,mod-2,mod);
}
void gauss(vector<vector<ll>>a,vector<ll>&ans)
{
  long n=a.size(),m=a[0].size()-1;
  vector<long>wh(m,-1);
  for(long col=0,row=0;col<m&&row<n;col++)
  {
    long swp=-1;
    for(long i=row;i<n;i++)
    {
      if(a[i][col])
      {
        swp=i;break;
      }
    }
    if(swp==-1)continue;
    for(long i=col;i<=m;i++)swap(a[row][i],a[swp][i]);
    wh[col]=row;
    for(long i=0;i<n;i++)
    {
      if(i==row)continue;
      long c=(a[i][col]*inv(a[row][col]))%mod;
      for(long j=0;j<=m;j++)
        a[i][j]=(a[i][j]-(a[row][j]*c)%mod+mod)%mod;
    }
    row++;
  }
  ans.assign(m,0);
  for(long i=0;i<m;i++)
  {
    if(wh[i]==-1)continue;
    ans[i]=(a[wh[i]][m]*inv(a[wh[i]][i]))%mod;
  }
}
long eval(long x,vector<long>ans)
{
  long p=1,sum=0;
  for(long i=0;i<=10;i++)
  {
    sum=(sum+p*ans[i])%mod;
    p=(p*x)%mod;
  }
  return sum;
}

int main() {
    optimize();
    fraction();

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin) ;
    freopen("output.txt","w",stdout);
     #endif

    ll n , i , j , cur;

    n = 11;
    dbg(MOD);

        vector<ll> line(n+1,0);
        vector< vector<ll> > A(n,line);

        for(i = 0 ; i < n ; ++i){
            cur = 1;
            cout << "? " << i << endl;
            cout.flush();
            ll res ;
            cin >> res;
            for(j = 0 ; j < n; ++j){
                A[i][j] = cur;
                cur = (cur*(i))%MOD;
            }
            A[i][n] = res;
        }

        vector<ll> ans;
         gauss(A,ans);

        for(i = 1 ; i < MOD ; ++i){
            ll sum = 0LL;
            cur = 1;
            for(j = 0 ; j < n ; ++j){
                cur = modMul(ans[j] ,cur);
                sum = modAdd(sum ,cur);
                cur = (cur*i)%MOD;
            }
            if(sum == 0){
                cout << "! " << i << endl;
                cout.flush();
                exit(0);
            }
        }
        cout << "! -1" << endl;
        cout.flush();

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll int
typedef pair<ll, ll> pll;
ll arr[SIZE];
ll t, n, temp,a,b, mod = 1000003;
ll f[11];
struct Data
{
	ll x, y;
};

ll modPow(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x) {
	return modPow(x, mod - 2);
}

vector<ll> polyMult(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1;
	vector<ll> ret(n + m + 1, 0);
	int k;
	for (int i = 0; i <= n + m; i++) {
		for (int j = 0; j <= n; j++) {
			k = i - j;
			if (k<0 || k>m)continue;
			ret[i] += (lhs[j] * rhs[k]);
			ret[i] %= mod;
		}
	}
	return ret;
}

vector<ll> polyAdd(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1, addSize = max(n, m) + 1;
	vector<ll> ret(addSize, 0);
	for (int i = 0; i < addSize; i++) {
		if (i <= n)ret[i] += lhs[i];
		if (i <= m)ret[i] += rhs[i];
		ret[i] %= mod;
	}
	return ret;
}

vector<ll> coeffMult(const vector<ll>& poly, const ll& num) {
	vector<ll> ret(poly.size(), 0);
	for (int i = 0; i < poly.size(); i++) {
		ret[i] = poly[i] * num;
		ret[i] %= mod;
	}
	return ret;
}

ll sub(const vector<ll>& poly, const ll& num) {
	ll tot = 0, numMult = 1;
	for (ll coeff : poly) {
		tot += coeff * numMult;
		numMult *= num;
		numMult %= mod;
		tot %= mod;
	}
	return tot;
}

vector<ll> interpolation(const vector<pll>& pts) {
	int n = pts.size();
	vector<ll> ret(1, 0);
	vector<ll> linear(2, 0);
	linear[1] = 1;
	for (int i = 0; i < n; i++) {
		vector<ll> cr(1, 0);
		ll coeff = 1;
		cr[0] = 1;
		for (int j = 0; j < n; j++) {
			if (i == j)continue;
			linear[0] = mod - pts[j].first;
			cr = polyMult(cr, linear);
			coeff *= modInverse(pts[i].first - pts[j].first);
			coeff %= mod;
		}
		ret = polyAdd(ret, coeffMult(coeffMult(cr, coeff), pts[i].second));
	}
	return ret;
}

ll query(int xq) {
	ll fxq;
	printf("? %d\n", xq);
	cout.flush();
	scanf("%lld",&fxq);
	return fxq;
}

int main() {
	ll ans;
	vector<pll> f;
	for (ll i = 0; i < 11; i++) f.pb(make_pair(i, query(i)));
	bool exists = false;
	vector<ll> pol = interpolation(f);
	for (int i = 0; i < mod; i++)
	{
		if (sub(pol, i) % mod == 0) {
			printf("! %d\n", i);
			fflush(stdout);
			exists = true;
			break;
		}
	}
	if (!exists) {
		printf("-1\n");
		fflush(stdout);
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll int
ll arr[SIZE];
ll t, n, temp,a,b, modu = 1000003;
ll f[11];
struct Data
{
	ll x, y;
};

ll modPow(ll x, ll y, ll mod)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x, ll mod) {
	return modPow(x, mod - 2, mod);
}

ll interpolate(Data f[], ll xi, ll n)
{
	ll result = 0;
	for (int i = 0; i < n; i++)
	{
		ll term = f[i].y;
		for (int j = 0; j < n; j++) {
			if (j != i)
				term = (term * (xi - f[j].x) * modInverse((f[i].x - f[j].x), modu)) % modu;
		}
		result += term;
	}
	return result % modu;
}

ll query(ll xq) {
	ll fxq;
	cout << "? " << xq << "\n";
	cout.flush();
	cin >> fxq;
	return fxq;
}

int main() {
	fast;
	ll ans;
	Data f[11];
	for (ll i = 0; i < 11; i++) f[i].x = i, f[i].y = query(i);
	bool exists = false;
	for (ll i = 0; i < modu; i++)
	{
		if ((ll)interpolate(f, i, 11) % modu == 0) {
			cout << "! " << i << "\n";
			cout.flush();
			exists = true;
			break;
		}
	}
	if (!exists) {
		cout << "-1\n";
		cout.flush();
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll long long
typedef pair<ll, ll> pll;
ll arr[SIZE];
ll t, n, temp,a,b, mod = 1000003;

ll modPow(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x) {
	return modPow(x, mod - 2);
}

vector<ll> polyMult(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1;
	vector<ll> ret(n + m + 1, 0);
	int k;
	for (int i = 0; i <= n + m; i++) {
		for (int j = 0; j <= n; j++) {
			k = i - j;
			if (k<0 || k>m)continue;
			ret[i] += (lhs[j] * rhs[k]);
			ret[i] %= mod;
		}
	}
	return ret;
}

vector<ll> polyAdd(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1, addSize = max(n, m) + 1;
	vector<ll> ret(addSize, 0);
	for (int i = 0; i < addSize; i++) {
		if (i <= n)ret[i] += lhs[i];
		if (i <= m)ret[i] += rhs[i];
		ret[i] %= mod;
	}
	return ret;
}

vector<ll> coeffMult(const vector<ll>& poly, const ll& num) {
	vector<ll> ret(poly.size(), 0);
	for (int i = 0; i < poly.size(); i++) {
		ret[i] = poly[i] * num;
		ret[i] %= mod;
	}
	return ret;
}

ll sub(const vector<ll>& poly, const ll& num) {
	ll tot = 0, numMult = 1;
	for (ll coeff : poly) {
		tot += coeff * numMult;
		numMult *= num;
		numMult %= mod;
		tot %= mod;
	}
	return tot;
}

vector<ll> interpolation(const vector<pll>& pts) {
	int n = pts.size();
	vector<ll> ret(1, 0);
	vector<ll> linear(2, 0);
	linear[1] = 1;
	for (int i = 0; i < n; i++) {
		vector<ll> cr(1, 0);
		ll coeff = 1;
		cr[0] = 1;
		for (int j = 0; j < n; j++) {
			if (i == j)continue;
			linear[0] = mod - pts[j].first;
			cr = polyMult(cr, linear);
			coeff *= modInverse(pts[i].first - pts[j].first);
			coeff %= mod;
		}
		ret = polyAdd(ret, coeffMult(coeffMult(cr, coeff), pts[i].second));
	}
	return ret;
}

ll query(ll xq) {
	ll fxq;
	cout << "? " << (int)xq << "\n";
	cout.flush();
	cin >> fxq;
	return fxq;
}

int main() {
	fast;
	ll ans;
	vector<pll> f;
	for (ll i = 0; i < 11; i++) f.pb(make_pair(i, query(i)));
	bool exists = false;
	vector<ll> pol = interpolation(f);
	for (int i = 0; i < mod; i++)
	{
		if (sub(pol, i) % mod == 0) {
			cout << "! " << (int)i << "\n";
			fflush(stdout);
			exists = true;
			break;
		}
	}
	if (!exists) {
		cout << "-1\n";
		fflush(stdout);
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll long long
typedef pair<ll, ll> pll;
ll arr[SIZE];
ll t, n, temp,a,b, mod = 1000003;

ll modPow(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x) {
	return modPow(x, mod - 2);
}

vector<ll> polyMult(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1;
	vector<ll> ret(n + m + 1, 0);
	int k;
	for (int i = 0; i <= n + m; i++) {
		for (int j = 0; j <= n; j++) {
			k = i - j;
			if (k<0 || k>m)continue;
			ret[i] += (lhs[j] * rhs[k]);
			ret[i] %= mod;
		}
	}
	return ret;
}

vector<ll> polyAdd(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1, addSize = max(n, m) + 1;
	vector<ll> ret(addSize, 0);
	for (int i = 0; i < addSize; i++) {
		if (i <= n)ret[i] += lhs[i];
		if (i <= m)ret[i] += rhs[i];
		ret[i] %= mod;
	}
	return ret;
}

vector<ll> coeffMult(const vector<ll>& poly, const ll& num) {
	vector<ll> ret(poly.size(), 0);
	for (int i = 0; i < poly.size(); i++) {
		ret[i] = poly[i] * num;
		ret[i] %= mod;
	}
	return ret;
}

ll sub(const vector<ll>& poly, const ll& num) {
	ll tot = 0, numMult = 1;
	for (ll coeff : poly) {
		tot += coeff * numMult;
		numMult *= num;
		numMult %= mod;
		tot %= mod;
	}
	return tot;
}

vector<ll> interpolation(const vector<pll>& pts) {
	int n = pts.size();
	vector<ll> ret(1, 0);
	vector<ll> linear(2, 0);
	linear[1] = 1;
	for (int i = 0; i < n; i++) {
		vector<ll> cr(1, 0);
		ll coeff = 1;
		cr[0] = 1;
		for (int j = 0; j < n; j++) {
			if (i == j)continue;
			linear[0] = mod - pts[j].first;
			cr = polyMult(cr, linear);
			coeff *= modInverse(pts[i].first - pts[j].first);
			coeff %= mod;
		}
		ret = polyAdd(ret, coeffMult(coeffMult(cr, coeff), pts[i].second));
	}
	return ret;
}

ll query(ll xq) {
	ll fxq;
	cout << "? " << (int)xq << "\n";
	cout.flush();
	cin >> fxq;
	return fxq;
}

int main() {
	fast;
	ll ans;
	vector<pll> f;
	for (ll i = 0; i < 11; i++) f.pb(make_pair(i, query(i)));
	bool exists = false;
	vector<ll> pol = interpolation(f);
	for (int i = 0; i < mod; i++)
	{
		if (sub(pol, i) % mod == 0) {
			cout << "! " << (int)i << "\n";
			fflush(stdout);
			exists = true;
			break;
		}
	}
	ll minusOne = -1;
	if (!exists) {
		cout << (int)minusOne << "\n";
		fflush(stdout);
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll long long
typedef pair<ll, ll> pll;
ll arr[SIZE];
ll t, n, temp,a,b, mod = 1000003;
ll f[11];
struct Data
{
	ll x, y;
};

ll modPow(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x) {
	return modPow(x, mod - 2);
}

vector<ll> polyMult(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1;
	vector<ll> ret(n + m + 1, 0);
	int k;
	for (int i = 0; i <= n + m; i++) {
		for (int j = 0; j <= n; j++) {
			k = i - j;
			if (k<0 || k>m)continue;
			ret[i] += (lhs[j] * rhs[k]);
			ret[i] %= mod;
		}
	}
	return ret;
}

vector<ll> polyAdd(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1, addSize = max(n, m) + 1;
	vector<ll> ret(addSize, 0);
	for (int i = 0; i < addSize; i++) {
		if (i <= n)ret[i] += lhs[i];
		if (i <= m)ret[i] += rhs[i];
		ret[i] %= mod;
	}
	return ret;
}

vector<ll> coeffMult(const vector<ll>& poly, const ll& num) {
	vector<ll> ret(poly.size(), 0);
	for (int i = 0; i < poly.size(); i++) {
		ret[i] = poly[i] * num;
		ret[i] %= mod;
	}
	return ret;
}

ll sub(const vector<ll>& poly, const ll& num) {
	ll tot = 0, numMult = 1;
	for (ll coeff : poly) {
		tot += coeff * numMult;
		numMult *= num;
		numMult %= mod;
		tot %= mod;
	}
	return tot;
}

vector<ll> interpolation(const vector<pll>& pts) {
	int n = pts.size();
	vector<ll> ret(1, 0);
	vector<ll> linear(2, 0);
	linear[1] = 1;
	for (int i = 0; i < n; i++) {
		vector<ll> cr(1, 0);
		ll coeff = 1;
		cr[0] = 1;
		for (int j = 0; j < n; j++) {
			if (i == j)continue;
			linear[0] = mod - pts[j].first;
			cr = polyMult(cr, linear);
			coeff *= modInverse(pts[i].first - pts[j].first);
			coeff %= mod;
		}
		ret = polyAdd(ret, coeffMult(coeffMult(cr, coeff), pts[i].second));
	}
	return ret;
}

ll query(int xq) {
	ll fxq;
	printf("? %d\n", xq);
	cout.flush();
	scanf("%lld",&fxq);
	return fxq;
}

int main() {
	ll ans;
	vector<pll> f;
	for (ll i = 0; i < 11; i++) f.pb(make_pair(i, query(i)));
	bool exists = false;
	vector<ll> pol = interpolation(f);
	for (int i = 0; i < mod; i++)
	{
		if (sub(pol, i) % mod == 0) {
			printf("! %d\n", i);
			fflush(stdout);
			exists = true;
			break;
		}
	}
	if (!exists) {
		printf("-1\n");
		fflush(stdout);
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll int
ll arr[SIZE];
ll t, n, temp,a,b, modu = 1000000 + 3;
ll f[11];
struct Data
{
	ll x, y;
};

ll modPow(ll x, ll y, ll mod)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x, ll mod) {
	return modPow(x, mod - 2, mod);
}

ll interpolate(Data f[], ll xi, ll n)
{
	ll result = 0;
	for (int i = 0; i < n; i++)
	{
		ll term = f[i].y;
		for (int j = 0; j < n; j++) {
			if (j != i)
				term = (term * (xi - f[j].x) * modInverse((f[i].x - f[j].x), modu)) % modu;
		}
		result += term;
	}
	return result % modu;
}

ll query(ll xq) {
	ll fxq;
	cout << "? " << xq << "\n";
	cout.flush();
	cin >> fxq;
	return fxq;
}

int main() {
	fast;
	ll ans;
	Data f[11];
	for (ll i = 0; i < 11; i++) f[i].x = i, f[i].y = query(i);
	for (ll i = 0; i < modu; i++)
	{
		if ((ll)interpolate(f, i, 11) % modu == 0) {
			cout << "! " << i << "\n";
			cout.flush();
		}
		break;
	}
	cout << "-1\n";
	cout.flush();
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll long long
typedef pair<ll, ll> pll;
ll arr[SIZE];
ll t, n, temp,a,b, mod = 1000003;

ll modPow(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x) {
	return modPow(x, mod - 2);
}

vector<ll> polyMult(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1;
	vector<ll> ret(n + m + 1, 0);
	int k;
	for (int i = 0; i <= n + m; i++) {
		for (int j = 0; j <= n; j++) {
			k = i - j;
			if (k<0 || k>m)continue;
			ret[i] += (lhs[j] * rhs[k]);
			ret[i] %= mod;
		}
	}
	return ret;
}

vector<ll> polyAdd(const vector<ll>& lhs, const vector<ll>& rhs) {
	int n = lhs.size() - 1, m = rhs.size() - 1, addSize = max(n, m) + 1;
	vector<ll> ret(addSize, 0);
	for (int i = 0; i < addSize; i++) {
		if (i <= n)ret[i] += lhs[i];
		if (i <= m)ret[i] += rhs[i];
		ret[i] %= mod;
	}
	return ret;
}

vector<ll> coeffMult(const vector<ll>& poly, const ll& num) {
	vector<ll> ret(poly.size(), 0);
	for (int i = 0; i < poly.size(); i++) {
		ret[i] = poly[i] * num;
		ret[i] %= mod;
	}
	return ret;
}

ll sub(const vector<ll>& poly, const ll& num) {
	ll tot = 0, numMult = 1;
	for (ll coeff : poly) {
		tot += coeff * numMult;
		numMult *= num;
		numMult %= mod;
		tot %= mod;
	}
	return tot;
}

vector<ll> interpolation(const vector<pll>& pts) {
	int n = pts.size();
	vector<ll> ret(1, 0);
	vector<ll> linear(2, 0);
	linear[1] = 1;
	for (int i = 0; i < n; i++) {
		vector<ll> cr(1, 0);
		ll coeff = 1;
		cr[0] = 1;
		for (int j = 0; j < n; j++) {
			if (i == j)continue;
			linear[0] = mod - pts[j].first;
			cr = polyMult(cr, linear);
			coeff *= modInverse(pts[i].first - pts[j].first);
			coeff %= mod;
		}
		ret = polyAdd(ret, coeffMult(coeffMult(cr, coeff), pts[i].second));
	}
	return ret;
}

ll query(ll xq) {
	ll fxq;
	cout << "? " << (int)xq << "\n";
	cout.flush();
	cin >> fxq;
	return fxq;
}

int main() {
	fast;
	ll ans;
	vector<pll> f;
	for (ll i = 0; i < 11; i++) f.pb(make_pair(i, query(i)));
	bool exists = false;
	vector<ll> pol = interpolation(f);
	for (int i = 0; i < mod; i++)
	{
		if (sub(pol, i) % mod == 0) {
			cout << "! " << (int)i << "\n";
			fflush(stdout);
			exists = true;
			break;
		}
	}
	int minusOne = -1;
	if (!exists) {
		cout << (int)minusOne << "\n";
		fflush(stdout);
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll long long
ll arr[SIZE];
ll t, n, temp,a,b, modu = 1000000 + 3;
ll f[11];
struct Data
{
	ll x, y;
};

ll modPow(ll x, ll y, ll mod)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x, ll mod) {
	return modPow(x, mod - 2, mod);
}

ll interpolate(Data f[], ll xi, ll n)
{
	ll result = 0;
	for (int i = 0; i < n; i++)
	{
		ll term = f[i].y;
		for (int j = 0; j < n; j++) {
			if (j != i)
				term = (term * (xi - f[j].x) * modInverse((f[i].x - f[j].x), modu)) % modu;
		}
		result += term;
	}
	return result % modu;
}

ll query(ll xq) {
	ll fxq;
	cout << "? " << xq << "\n";
	cout.flush();
	cin >> fxq;
	return fxq;
}

int main() {
	fast;
	ll ans;
	Data f[11];
	for (ll i = 0; i < 11; i++) f[i].x = i, f[i].y = query(i);
	for (ll i = 0; i < modu; i++)
	{
		if ((ll)interpolate(f, i, 11) % modu == 0) {
			cout << "! " << i << "\n";
			cout.flush();
		}
		break;
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <algorithm>
#include <string>
# include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
using namespace std;
#define SIZE 500000
#define ll int
ll arr[SIZE];
ll t, n, temp,a,b, modu = 1000000 + 3;
ll f[11];
struct Data
{
	ll x, y;
};

ll modPow(ll x, ll y, ll mod)
{
	ll res = 1;
	x = x % mod;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}

ll modInverse(ll x, ll mod) {
	return modPow(x, mod - 2, mod);
}

ll interpolate(Data f[], ll xi, ll n)
{
	ll result = 0;
	for (int i = 0; i < n; i++)
	{
		ll term = f[i].y;
		for (int j = 0; j < n; j++) {
			if (j != i)
				term = (term * (xi - f[j].x) * modInverse((f[i].x - f[j].x), modu)) % modu;
		}
		result += term;
	}
	return result % modu;
}

ll query(ll xq) {
	ll fxq;
	cout << "? " << xq << "\n";
	cout.flush();
	cin >> fxq;
	return fxq;
}

int main() {
	fast;
	ll ans;
	Data f[11];
	for (ll i = 0; i < 11; i++) f[i].x = i, f[i].y = query(i);
	for (ll i = 0; i < modu; i++)
	{
		if ((ll)interpolate(f, i, 11) % modu == 0) {
			cout << "! " << i << "\n";
			cout.flush();
		}
		break;
	}
	cout << "! -1\n";
	cout.flush();
}