"Is playing Dual Star hard? I'm rks 12.66."
As everyone knows, Phigros requires calibration of the note offset. In the distant (or perhaps not so distant) future, Klose-Karl invented a machine that can automatically play Phigros, but she somehow forgot what note offset she set for the machine!
Consequently, she achieved a score of all "Bad" and left the laboratory in a rage. You arrived at the laboratory and saw the machine in a mess. To help Klose-Karl, you decide to secretly measure the machine's note offset.
This is an interactive problem.
The interactor has an integer $x \in [-400, 600]$. Each time, you can query an integer $y \in [-1000, 1000]$, and the interactor will return an answer based on the following conditions:
- "Perfect": $|x - y| \in [0, 80]$.
- "Good": $|x - y| \in (80, 160]$.
- "Bad": $|x - y| \in (160, 180]$.
- "Miss": $|x - y| \in (180, \infty)$.
You need to return the correct result $x$ within 10 queries.
Interaction
This problem involves multiple test cases.
The first line contains the number of test cases $T$ ($1 \le T \le 1000$).
For each test case:
When you need to make a query:
- Output in the format "? y" and flush the buffer. You must ensure $-1000 \le y \le 1000$, and the current number of queries (including this one) does not exceed 10; otherwise, the interactor will encounter an unknown error.
- Afterward, read a string $s$ representing the received information.
Once you have obtained the answer, output in the format "! x" and flush the buffer.
After processing all test cases, terminate the program immediately.
Examples
Input 1
1 Perfect Good Miss
Output 1
? 0 ? 100 ? 200 ! 0
Note
When the answer is 0, the results of querying 0, 100, and 200 are as shown in the example.
How to flush the buffer:
- In C and C++, use
fflush(stdout)(if you useprintf) orcout.flush()(if you usecout). - In Python, use
stdout.flush(). - Specifically, in C++, using
cout << endlwill automatically flush the buffer.
If you still have questions about interactive problems, a sample code is provided below:
#include<stdio.h>
#include<string.h>
#include<iostream>
int main(){
int t; cin>>t;
while(t--){
cout<<"? "<<0<<endl;
string s;cin>>s;
printf("0\n"); fflush(stdout);
}
return 0;
}
If you have nothing better to do, you can try to figure out how to solve this problem in 9 queries.