Tashdid has a secret array of size . For each index of the array, he will randomly choose an integer between and (both inclusive) and set the value of that index to that random integer.
After creating the arrays, Tashdid gave you a task. You have to guess the bitwise-and value of the whole array.
Now as you don't know the secret array, you will make a guess based on probability. You will guess a number so that the probability of your answer being correct is the most. If there exists more than one number with the same probability then you will guess the highest number with that probability. What is your guess?
You have to answer several queries. In all the queries the values of and remain same, only the size of the array changes.
The first line contains two space-separated integers and .
The next line contains a single integer , the number of queries.
Each of the next lines contains one integer each, , the size of the array in the i’th query.
For each of the queries, print an integer in a line, your guess for that query.
Input | Output |
---|---|
1 4 3 1 2 3 | 4 0 0 |
Input | Output |
---|---|
5 7 3 1 2 3 | 7 6 4 |