#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; int ref = 0; vector prod(N, -1); for (int i = 1; i < N; i++) { cout << "? " << ref << ' ' << i << '\n'; cout.flush(); int p; cin >> p; if (p == -1) return 0; // judge says wrong / too many queries prod[i] = p; } // Try all possible digits for the reference position. vector candidates; for (int d = 0; d <= 9; d++) { bool ok = true; for (int i = 1; i < N; i++) { int p = prod[i]; if (p % d != 0) { ok = false; break; } int x = p / d; if (x < 0 || x > 9) { ok = false; break; } } if (ok) candidates.push_back(d); } if ((int)candidates.size() != 1) { cout << "! -1\n"; cout.flush(); return 0; } int d0 = candidates[0]; vector dig(N); dig[0] = d0; for (int i = 1; i < N; i++) dig[i] = prod[i] / d0; // Build the number from least significant digit to most significant digit. long long X = 0; long long pw = 1; for (int i = 0; i < N; i++) { X += pw * dig[i]; pw *= 10; } cout << "! " << X << '\n'; cout.flush(); return 0; }