BABA PRIME

0

0 votes
Problem

Baba, a studious guy, was very fond of prime numbers and kept experimenting on them all the time until one day when he encountered a quadratic equation given by his mathematics professor, Dr.Suket. He accepted the challenge. Help him out. Dr.Suket gave him an equation Ax^2+Bx+C, and asked him to find out the least number X such that result was not a prime number. A,B and C will be given as input.

INPUT: First line of input contains a number 'T' denoting the number of test cases. In next T lines, each line consists of 3 numbers denoting A, B and C separated by single space.

OUTPUT: In a single line output a single smallest non-negative integer X, such that the equation Ax^2+Bx+C is not a prime number.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?