This problem is a programming version of Problem 216 from projecteuler.net
Consider three integers , and where , and is not the square of an integer.
Let the second degree polynomial . In this challenge, we will be interested in the prime values of for integers .
E.g. with , and , the first such prime numbers are , , , , , and .
How many numbers are prime for ?
The first line of each test case contains three space-separated integers , and .
The second line contains a single integer which is the number of queries.
Each of the next lines contains a value of .
Print the answer to each query in a new line.
Sample Input 0
2 0 -1
Sample Output 0
The values of for are :
Sample Input 1
2 0 1
Sample Output 1
The evaluation of for yields to :
Sample Input 2
1 0 1
Sample Output 2
There exist prime numbers of the form where : .