H. Farouk and Tape
time limit per test
3 с
memory limit per test
256 megabytes
input
standard input
output
standard output

Farouk has a very long piece of tape divided into cells extending into the positive and negative directions. The cells are indexed by the integers and are colored in alternating black and white segments of equal length. For example, a valid coloring is 3 black cells, followed by 3 white cells, then 3 black cells, and so on. However, as Farouk is quite short, he can't see the entire tape at once and can only ask about the color of one cell at a time. Help Farouk determine the length of the segments in no more than $$$2000$$$ queries.

It is guaranteed that the tape contains at least 5 complete segments.

Input

Each test contains multiple test cases. The first and only line contains $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases.

Interaction

For each test case, there is initially no input.

To ask about the color of a cell, output a line in the following format:

  • $$$\textbf{? } x$$$ ($$$-10^{18} \le x \le 10^{18}$$$)

The jury will reply with a line containing either "B" or "W" — the color of cell $$$x$$$.

Once you have determined the length of the segments, output a line in the following format:

  • $$$\textbf{! } L$$$

Where $$$L$$$ ($$$1 \le L \le 10^{18}$$$) denotes the length of the segments.

Note that outputting the length does not count towards the query limit.

If your solution exceeds $$$2000$$$ queries in one test case, your program must terminate immediately to receive the verdict Wrong Answer. Otherwise, it may receive any other verdict.

After outputting a query, do not forget to output the end of the line and flush the output. Otherwise, you may get Idleness limit exceeded or some other verdict. To do this, use the following:

  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • stdout.flush() in Python;
  • see the documentation for other languages.

The interactor is non-adaptive; the coloring is determined before the interaction starts.

Note

Example of interaction:

SolutionJury
? 0
B
? 1
B
? 2
W
? 3
W
? 4
W
? 5
B
! 3