#P1780D. Bit Guessing Game

    ID: 341 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 6 Uploaded By: Tags>binary searchbitmasksconstructive algorithmsinteractive*1800

Bit Guessing Game

Description

This is an interactive problem.

Kira has a hidden positive integer nn, and Hayato needs to guess it.

Initially, Kira gives Hayato the value cnt\mathrm{cnt} — the number of unit bits in the binary notation of nn. To guess nn, Hayato can only do operations of one kind: choose an integer xx and subtract it from nn. Note that after each operation, the number nn changes. Kira doesn't like bad requests, so if Hayato tries to subtract a number xx greater than nn, he will lose to Kira. After each operation, Kira gives Hayato the updated value cnt\mathrm{cnt} — the number of unit bits in the binary notation of the updated value of nn.

Kira doesn't have much patience, so Hayato must guess the original value of nn after no more than 3030 operations.

Since Hayato is in elementary school, he asks for your help. Write a program that guesses the number nn. Kira is an honest person, so he chooses the initial number nn before all operations and does not change it afterward.

The input data contains several test cases. The first line contains one integer tt (1t5001 \le t \le 500) — the number of test cases. The description of the test cases follows.

The first line of each test case contains the number cnt\mathrm{cnt} — the initial number of unit bits in the binary notation nn.

The hidden integer nn satisfies the following constraint: 1n1091 \le n \le 10^9.

Interaction

To guess nn, you can perform the operation at most 3030 times. To do that, print a line with the following format: "- x" (1x1091 \le x \le 10^9).

After this operation, the number xx is subtracted from nn, and therefore nn is changed. If the number xx is greater than the current value of nn, then the request is considered invalid.

After the operation read a line containing a single non-negative integer cnt\mathrm{cnt} — the number of unit bits in the binary notation of the current nn after the operation.

When you know the initial value of nn, print one line in the following format: "! n" (1n1091 \le n \le 10^9).

After that, move on to the next test case, or terminate the program if there are none.

If your program performs more than 3030 operations for one test case, subtracts a number xx greater than nn, or makes an incorrect request, then response to the request will be -1, after receiving such response, your program must exit immediately to receive the Wrong Answer verdict. Otherwise, you can get any other verdict.

After printing a query or the answer, do not forget to output the end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

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

Hacks

To make a hack, use the following format.

The first line should contain a single integer tt (1t5001 \leq t \leq 500).

Each test case should contain one integer nn (1n1091 \leq n \leq 10^9) on a separate line.

Input

The input data contains several test cases. The first line contains one integer tt (1t5001 \le t \le 500) — the number of test cases. The description of the test cases follows.

The first line of each test case contains the number cnt\mathrm{cnt} — the initial number of unit bits in the binary notation nn.

The hidden integer nn satisfies the following constraint: 1n1091 \le n \le 10^9.

Sample Input 1

3

1

0

1

1

0

2

1

0

Sample Output 1

- 1

! 1

- 1

- 1

! 2

- 2

- 1

! 3

Note

For example, the number of unit bits in number 66 is 22, because binary notation of 66 is 110110. For 1313 the number of unit bits is 33, because 1310=1101213_{10} = 1101_2.

In the first test case, n=1n = 1, so the input is the number 11. After subtracting one from nn, it becomes zero, so the number of unit bits in it is 00.

In the third test case, n=3n = 3, which in binary representation looks like 310=1123_{10} = 11_2, so the input is the number of ones, that is 22. After subtracting 22, n=1n = 1, so the number of unit bits is now 11. After subtracting one from nn, it becomes equal to zero.

Note that the blank lines in the input and output examples are shown for clarity and are not present in the actual interaction.