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:
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.
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,
Please note that, there is no additional constraint on sum of $$$n$$$, sum of $$$m$$$, or sum of $$$n \cdot m$$$ over the testcases.
2 2 3 10 3 4 1 1 1
? 1 1 ? 2 2 ? 1 3 ! 42 ? 1 1 ! 1
In the first test case, the matrix is:
| 10 | 5 | 4 |
| 8 | 3 | 1 |
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.
| Name |
|---|


