Chotu on his new mission has to crack a safe to get intel on "cobalt". The lock is programmed such that it displays N numbers and generates Q queries when someone tries to open it. The safe opens when each query is answered correctly.
For each query the lock displays an index I, the numbers at the Ith index disappears, the answer to the query is the product of remaining numbers on the screen modulo M.
There is not much time left help so Chotu needs your help to crack the safe open.
Note - After each query, the number reappears at the Ith index.
Input
First line of input contains 3 integers N, M and Q , the number of elements, the value of Modulus ans the number of queries.
Next line contains N integers.
Next Q lines contain an integer I, denoting the index of the number that dissapears in the query.
Output
For each query print the answer in a seperate line.
Constraints
1 <= N <= 105
1 <= Q <= 105
1 <= M <= 104
1 <= Ai <= 104
1 <= I <= N
For first query the product of elements after removing the 3rd element will be 2 * 4 * 2 * 5 = 80. So the answer is 80 % 6 = 2.
For 2nd query, the product will be 2 * 3 * 2 * 5 = 60. So answer is 60 % 6 = 0.