#include using namespace std; long long ask(int a, int b) { cout << "? " << a << " " << b << endl; cout.flush(); long long x; cin >> x; if (x == -1) exit(0); return x; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector d(N); int i = 0; while (i + 2 < N) { long long ab = ask(i, i+1); long long ac = ask(i, i+2); long long bc = ask(i+1, i+2); bool found = false; for (int A = 0; A <= 9; A++) { for (int B = 0; B <= 9; B++) { for (int C = 0; C <= 9; C++) { if (A * B == ab && A * C == ac && B * C == bc) { d[i] = A; d[i+1] = B; d[i+2] = C; found = true; goto done; } } } } done: if (!found) { cout << "! -1" << endl; cout.flush(); return 0; } i += 3; } // Handle remaining digits if (i < N) { if (i > 0) { long long p = ask(i-1, i); if (d[i-1] == 0) { // ambiguous → cannot determine cout << "! -1" << endl; cout.flush(); return 0; } d[i] = p / d[i-1]; } } if (i + 1 < N) { long long p = ask(i, i+1); if (d[i] == 0) { cout << "! -1" << endl; cout.flush(); return 0; } d[i+1] = p / d[i]; } // Build number long long X = 0, pw = 1; for (int i = 0; i < N; i++) { X += pw * d[i]; pw *= 10; } cout << "! " << X << endl; cout.flush(); }