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 x be the previous random number. The next number y is then given by:
y = ax^2+ bx + c (mod 2^n)
where a, b, c and n are some 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 his program, and for that he needs to figure out what the previous values of the RNGs were. So in short, given the parameters of a certain RNG and the current number y, he wants to know what the previous number x was. Can you help him?
The first line contains a single number: the number of test cases to follow. Each test case has the following format:
One line with five integers y, a, b, c and n (0 ≤ y, a, b, c < 2^n, 1 ≤ n ≤ 31): the last value of the RNG and its four parameters, respectively.
For every test case print one integer on a single line: the previous value x of the RNG (0 ≤ x < 2^n). If there is no such number, or more than one such number, the output should be "No unique solution" (without the quotation marks) on a single line.