Tom is making a new computer game. It's an adventure game featuring both ninjas and pirates; fun guaranteed!
Various elements of the game contain a random factor. Therefore, the game makes use of various random number generators, or RNG for short. Each RNG uses the following formula: let be the previous random number. The next number is then given by:
where , , , and are integer parameters.
For the purpose of testing the game, Tom can interrupt the game and consult debug output. Some of the valuable pieces of information are the last values the RNGs have produced. However, Tom often wishes to backtrack the program, and for that he needs to figure out what the previous value of the RNG was. So in short, given the parameters of a certain RNG and the current number , he wants to know what the previous number was. Can you help him?
The first line contains the number of test cases. Each test case has the following format:
One line with five integers , , , , and (0 \le y, a, b, c < 2^n, 1 \le n \le 31): the last value of the RNG and its four parameters, respectively.
For each test case, print in a separate line the previous value (0 \le x < 2^n) of the RNG. If there is no such number, or more than one such number, output No unique solution (without quotation marks) in a separate line.
Example 1