Guess the modulo

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Fimka Sobak, unlike Ellochka the Cannibal, was reputed to be a cultured girl. In addition to her favorite smart buzzword, the \ldots-ality, she learned a remarkably entertaining game, "Guess the modulo".

The game is played in the following way. There are two players: the leader and the player. The leader initially thinks of two numbers: NN --- the number of numbers to be summed and MM --- the modulo. The leader tells the player the number NN, and the player must guess the number MM. Moreover, the leader thinks of an array of (N1)(N-1) numbers and tells it to the player.

During the game the player tells the leader numbers to get more information. Every time the player says a number, the leader:

  1. appends it to the end of his array,
  2. calculate SS --- the sum of the last NN numbers in the array by the modulo MM,
  3. appends SS to the end of the array and
  4. tells SS to the player.

As soon as the player guesses the value of the modulo MM, he or she informs the leader.

It is known that the modulo MM lies within the range between 22 and 10910^9, inclusively.

입력

The first line of the input stream contains a single integer NN (2N1002 \le N \le 100). The following line contains (N1)(N-1) space-separated integers ranging from 00 to 10910^9 inclusively.

The following lines of the input stream contain answers to questions. Each answer is the sum of the last NN elements of its array by modulo MM.

출력

You should print the queries and the player's answer into the standard output.

Player query format: "? p", p --- the number added by the player to the array. The number pp must be integer and must lie within the range from 00 to 10910^9 inclusively.

Player answer format: "! M", M --- the modulo in question.

Make sure that each query ends with a line break and that you flush the output stream buffer (the flush command of the language). Otherwise the solution may get the verdict Deadlock.