H. Matrix Sum Approximation
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

There is a hidden matrix $$$M$$$ with $$$n$$$ rows numbered $$$1, 2, \ldots n$$$ and $$$m$$$ columns numbered $$$1, 2, \ldots m$$$. Let $$$(i, j)$$$ denote the cell with row number $$$i$$$ and column number $$$j$$$, and let $$$M[i][j]$$$ denote the matrix value in the cell $$$(i, j)$$$. The matrix is guaranteed to satisfy the following properties:

  • The matrix values are integers in the range $$$[1, 10^9]$$$, that is $$$1 \leq M[i][j] \leq 10^9$$$ for all $$$1 \leq i \leq n, 1 \leq j \leq m$$$.
  • For any row $$$1 \leq i \leq n$$$, and column $$$1 \leq j \lt m$$$, $$$M[i][j] \geq M[i][j + 1]$$$.
  • For any row $$$1 \leq i \lt n$$$, and column $$$1 \leq j \leq m$$$, $$$M[i][j] \geq M[i + 1][j]$$$.

In other words, every row and every column of the matrix is non-increasing.

To know the value of the cell $$$(i, j)$$$ of the matrix, you can make a query of the form (without quotes):

"? i j"

where $$$1 \leq i \leq n$$$ and $$$1 \leq j \leq m$$$. In response, you get the value of $$$M[i][j]$$$.

You are allowed to make at most $$$50$$$ queries, and your task is to approximate the sum of the matrix to within a factor of $$$2$$$. In particular, if the actual sum is $$$X$$$, you need to output an integer $$$Y$$$ such that $$$\lceil X/2 \rceil \leq Y \leq 2\cdot X$$$.

Note that the grader is adaptive, which means that the matrix is not fixed before the interaction begins. However, the judge will never contradict the replies given in the past. This means that, it is guaranteed at each point of time that there exists a valid matrix with the aforementioned properties, whose values are consistent with the responses of the judge to the past queries.

Interaction

First, read an integer $$$t (1 \leq t \leq 200)$$$, denoting the number of test-cases. Each test case should be considered independently. For each test case,

  • First read two space separated integers, $$$n (1 \leq n \leq 10^4)$$$ and $$$m(1 \leq m \leq 10^4)$$$. It is guaranteed that $$$n \cdot m \leq 10^4$$$.
  • Then, whenever you want to know $$$M[i][j]$$$ for some $$$1 \leq i \leq n, 1 \leq j \leq m$$$, you should output "? i j" on a new line, without quotes. The judge replies with the value of $$$M[i][j]$$$.
  • When you have a $$$2-$$$ approximation of the sum (say an integer $$$Y$$$), you should output "! Y" on a new line, without quotes, and then move to the next testcase (if any).

Please note that, there is no additional constraint on sum of $$$n$$$, sum of $$$m$$$, or sum of $$$n \cdot m$$$ over the testcases.

Example
Input
2
2 3

10

3

4

1 1

1
Output


? 1 1

? 2 2

? 1 3

! 42

? 1 1

! 1

Note

In the first test case, the matrix is:

1054
831

The total sum is $$$10+5+4+8+3+1 = 31$$$, and the output sum is $$$42$$$, which is a valid $$$2-$$$approximation, since $$$16 \leq 42 \leq 62$$$.

In the second test-case, the matrix is a single cell with value $$$1$$$, and hence the output $$$1$$$ is considered correct.