D. Government Census
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

There are exactly $$$n$$$ cities in Byteland. The country is governed by a president, and there are exactly $$$a_i$$$ ministers in the city number $$$i$$$, which we will call the size of the ministry of this city. In any particular city, the ministers are numbered consecutively with positive integers starting from $$$1$$$ to $$$a_i$$$.

Today, the president decided to find out how many ministers there are in Byteland. To do this, he can make two types of queries:

  1. "- i x" — decrease the size of the ministry of the $$$i$$$-th city by $$$x$$$. In this case, if $$$x$$$ is greater than the number of ministers in the city, nothing happens. Otherwise, $$$x$$$ ministers with the maximum numbers will retire.
  2. "? i" — ask the most important minister of city $$$i$$$ how many cities (including city $$$i$$$) currently have the same or greater ministry size. If there are no ministers left in city $$$i$$$, the answering machine will tell the president the number $$$n$$$.

Help the president determine how many ministers there were in Byteland in the beginning, meaning that even if their number decreases during the process of finding the answer, the president wants to know how many there were initially. Of course, the president's time is very valuable, so he can not make more than $$$q$$$ queries.

Input

The first input line contains an integer $$$t$$$ — the number of data sets in the test ($$$1 \le t \le 5$$$). It is guaranteed that in all tests except for the example $$$t = 5$$$.

The second input line contains three space-separated integers $$$n$$$, $$$h$$$, and $$$q$$$ — the number of cities, the limit on the number of ministers in each city, and the limit on the number of queries ($$$1 \le n \le 5000$$$; $$$1 \le h \le 10^6$$$; $$$1 \le q \le 24\,000$$$). These constraints apply to all data sets in the current test.

After that, the interaction protocol with the interactor is launched $$$t$$$ times.

Output

When your program is ready to give an answer to the problem, it should output "! A" (without quotes), where $$$A$$$ is the presumed answer. After that, the program should move on to the next set of data or terminate according to the rules described in the next section.

Interaction

The interactor expects your program to make requests of three types: "- i x", "? i", and "! a", where $$$i$$$, $$$x$$$, and $$$A$$$ are integers ($$$1 \le i \le n$$$; $$$0 \le x \le h$$$). Each request should be followed by a newline character. If your program does not comply with the request format, it may receive an arbitrary verdict (other than OK).

In response to a request of the first type, the interactor replies on a new line with "OK" if the operation was successful or "FAIL" if there were less than $$$x$$$ ministers in the $$$i$$$-th city. In response to a request of the second type, the interactor also responds on a new line with the number of cities in which there are no less ministers than in city $$$i$$$.

A request of the third type means that your program is ready to give an answer to the problem. If $$$A$$$ is the correct answer, the interactor will output "OK" and move on to the next test in this multi-test or terminate if there is none. If the answer is incorrect, the interactor outputs "-1" and terminates with the verdict WA.

Your program can make no more than $$$q$$$ requests of the first or second type. The request of the third type (answer to the test) is not counted towards this limit. If this limit is exceeded, the interactor outputs "-1" and terminates with the verdict WA.

Note that the termination of the interactor means that the following tests of this multi-test will be skipped. To avoid receiving the TL or IL verdicts in this case, your program must terminate with a zero exit code when reading the value "-1" from the input.

Scoring

In this problem, there are 25 tests, in addition to the example test. Each test is evaluated independently according to the criteria below, and is worth a maximum of 4 points. The input constraints used in each test are specified in the table at the end of this section.

Points for a test are awarded only if the correct answer was given on each of the $$$t$$$ data sets without exceeding the query limit. In this case, the score for each dataset is calculated according to the formula $$$$$$\mathtt{score}\left(c, j\right) = \max\left(1,\: 4 - \left\lfloor\max\left(0, \frac{c - j}{\gamma}\right)\right\rfloor\right)$$$$$$ where $$$c$$$ is the number of iterations performed by your program, $$$j$$$ is the number of iterations performed by the jury's solution, and $$$\gamma$$$ is a parameter separately specified for each test.

The final score for a test is the minimum of the $$$t$$$ scores for its data sets.

Test number$$$n$$$$$$h$$$$$$q$$$$$$\gamma$$$Extra constraints
2101024 00012 000-
320100020 0006000-
410002020 0004000-
510001006 0002000 The sizes of the ministries in different cities do not exceed $$$50$$$ distinct values
6500050060005-
75000500015 000100-
8180020 00024 000250 The sizes of ministries in any two different cities differ by at least $$$5$$$
910010001000300-
105001 000 00010 0002500-
11300800 0004000600 The geometric mean of the sizes of the ministries does not exceed $$$20$$$
123501 000 0005000700 The geometric mean of the sizes of the ministries does not exceed $$$35$$$
131002003801-
14100500070010-
152000500 00010 000100-
1610010 000100050-
172000500 00010 500150-
1820001 000 00010 03050-
1920001 000 00010 03020-
201001 000 00018205-
212001 000 000342015-
222001 000 00034205-
23501 000 000100030-
243601 000 000650020-
257201 000 00012 00030-
269001 000 00014 00040-
Example
Input
1
3 3 6

3

OK

OK

3

FAIL

OK

OK
Output


? 1

- 1 1

- 2 3

? 1

- 3 3

- 3 2

! 6
Note

This is an interactive problem. When using buffered output, do not forget to flush the buffer when outputting requests (sys.stdout.flush() in Python, System.out().flush() in Java, and std::cout.flush() in C++).

In the example from the statement, the following actions occur:

  1. The first query determines that the first ministry is the smallest, since each of the three cities has at least as many ministers as that ministry.
  2. The next two actions retire one minister from the first city and three from the second. From the fact that $$$h = 3$$$ and the interactor's response to the query "- 2 3" is OK, we can conclude that there were exactly $$$3$$$ ministers in the second city.
  3. After that, it is determined that there are no fewer ministers in any city than in the first city. But we know that there are now $$$0$$$ ministers in the second city, so there must also be $$$0$$$ in the first city, which means there was $$$1$$$ before.
  4. With the last two queries, after an unsuccessful attempt to retire three ministers from the third city and a successful attempt to retire two, we understand that there were exactly $$$2$$$ ministers in the third city.

Thus, the answer to the test from the statement is $$$1 + 3 + 2 = 6$$$. Note also that $$$q = 6$$$, and exactly $$$6$$$ queries of the form - and ? were made, while the ! query is not counted in this number.