Joker's challenge

0

0 votes
Medium, Brute-force search, Hiring, Implementation, Recruit, Number Theory, Prime Factorization, Modular exponentiation, Ready, Mathematics, Sieve, Approved
Problem

Joker planted a bomb in the city and challenged Batman to find the bomb before 11:30 PM :-) as it will explode at 11:30 PM. To make the situation little easy for batman Joker gives him a problem and answer to the problem is pseudo code for location.

consider the equation-

F(x):x2+ax+b

G(x)=( Product of all factors of F(x))modulo(1000000007) ,

where F(x) is defined above.

G(x) is the pseudo code.

Help Batman calculating G(x) for a given set of values : a, b and x and help him save the city .

Input Format :

The first line contains one integer T , the number of integers. Each of the T test cases consists of 3 integers x , a and b respectively.

Output Format :

For each test case, output G(x) , as mentioned in the problem statement.

Input Constraints :

1T10
1a,b109
1x5108

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For first test case, F(x) = 3. Factors = 1,3.

For second test case, F(x) = 6, Factors = 1,2,3,6.

Editor Image

?