#P2216. Roulette

Roulette

Description

The political Party needs some money to lead its campaign. PSOS have insufficient funds in this time, so they want to earn some money. One of the new members have designed a completely Electronic Roulette in Monte Carlo some time ago. During the obligatory Learn-How-to-Say-the-Truth Course, the member said that the random number generator follows the equation:

xk+1

= (A * xk) mod 47

in which xk+1

is the random number following the previous number xk, and A is the Constant of the Day that is determined by the director Karl Monte each morning. PSOS sent several members to Monte Carlo immediately, to get some money. The problem is that the author of the algorithm suddenly died during the Course. PSOS now need somebody who is able to break the algorithm and predict pseudo-random numbers. Given the succession

xt-n

, x

t-n+1

, ..., x

t-1

, xt

the program should be able to decide, what the next number xt+1

will be. The Constant A is always integer, non-negative, and less then 1000000. All the numbers xi are integer and non-negative.

Input

At the first line there is a positive integer N stating the number of assignments to follow. Each assignment consists of exactly two lines. There is an integer non-negative number M at the first line of each assignment. The next line contains the succession of exactly M numbers (x1, x2, ... xM) separated by spaces.

Output

Output a single line for each assignment. If it is possible to determine the next number in the succession, the line must contain the sentence "Vsad na X." (Bet on X). Replace X with the number which will follow in the succession. If it is not possible to determine the following number, output the sentence "Dalsi cislo nelze urcit." (It is not possible to determine the next number). If the given succession does not follow the above equation, output the sentence "Algoritmus byl zmenen." (The algorithm was changed).

3
1
5
3
7 33 28
3
25 26 25
Dalsi cislo nelze urcit.
Vsad na 38.
Algoritmus byl zmenen.

Source

CTU FEE Local 1998