Walt and Gus have a great rivalry. Recently Gus has developed a cryptographic system. Walt is trying to crack it. While trying, he has found out that there is an array C of integers lying under the cryptographic system. Walt needs some information about the array C.
Walt has developed an algorithm to generate random integers. He calls the random integers generated by this algorithm as "Crypto-Number". The algorithm is as follows:
It is guaranteed that the generated "Crypto-Number" follows this constraint: .
Lets simulate the algorithm:
Step 1: The "Crypto-Number" = 1.
Step 2: Let, Walt chooses 81, 3 as , respectively. Result of multiplication is .
Step 3: The new value of "Crypto-Number" = 531441.
If Walt repeats the steps 2 and 3 again:
Step 2: Let, Walt chooses 6, 5 as , respectively this time. Result of multiplication is .
Step 3: The new value of "Crypto-Number" = 4132485216.
And so on.
Now Walt wants to know, for a Crypto-Number , how many integers are in the array such that is completely divisible by them.
The first line of the input contains an integer (), the size of the array . The next line will contain space-separated integers () - the elements of the array .
The next line contains an integer (), the number of the queries. In each of the next lines, there will be an integer () - the "Crypto-Number".
For each query, print in this format in a single line (without quotes): “Query x: y”, where is the number of the query and is the number of the integers in the array , which integers can completely divide .
Input | Output |
---|---|
6 1 8 4 18 13 8 4 16 36 8 169 | Query 1: 4 Query 2: 3 Query 3: 4 Query 4: 2 |
In the first query, the integers in index 0, index 1, index 2 and index 5 in array completely divide 16. That is to say, the 4 integers in array : 1, 8, 4, 8 completely divide 16. |