P18139 [NWRRC 2026] Hidden Integer
Description
*This is an interactive problem.*
The interactor has a hidden integer $n$ between $1$ and $10^9$, inclusive. Your task is to determine it.
For each query, you choose an integer $x$ between $1$ and $10^9$, inclusive. The response is
$$
(n \bmod x) \bmod 2.
$$
Here $a \bmod b$ denotes the remainder when $a$ is divided by $b$.
You may make at most $30$ queries.
Input Format
The interactor does not send any initial input.
After each query, read the response, either $0$ or $1$, equal to $(n \bmod x) \bmod 2$.
Output Format
To make a query, print a line of the form `? x`, where $x$ is an integer ($1 \le x \le 10^9$).
When you have determined $n$, print a line of the form `! n`, where $n$ is the hidden integer ($1 \le n \le 10^9$). Then terminate the program.
You may make at most $30$ queries. Printing the final answer does not count as a query.
The interactor is not adaptive: the hidden value $n$ is fixed before the interaction begins.
Explanation/Hint
#### Sample 1 Explanation
This example shows a possible exchange with $n = 5$, so the final answer is correct. In a test with $n = 15$, the same queries would produce the same responses, but the final answer would be wrong. These queries alone do not determine the hidden integer.
The blank lines in the example show the order of queries and responses. They are not part of the actual interaction.