P15883 [HackerEarth] Ram has a candy bar that he really wants to eat. However, there is a polynomial written on the wrapper which he has to solve. If he doesn't , then the candy will no longer be sweet and t
普及
题目描述

Ram has a candy bar that he really wants to eat. However, there is a polynomial written on the wrapper which he has to solve. If he doesn't , then the candy will no longer be sweet and turn bitter. The question on the wrapper is that if x is the least non negative integer satisfying the polynomial Ax^2+Bx-C ≥ 0, then calculate the factorial of x. Help Ram eat his candy!

Input: The first line contains no. of test cases, followed by A,B and C in the next line.

Output: Print the factorial of x. Format output just as shown.

Constraints:

0 ≤ T ≤ 50

0 ≤ A ≤ 10^5

0 ≤ B ≤ 10^5

0 ≤ C ≤ 10^6

0 ≤ x ≤ 20

SAMPLE INPUT
1
2 12 53

SAMPLE OUTPUT
6

输入格式

见题面

输出格式

见题面

样例输入
35 11 13 780 73 76 4000 4000 50000 600000 40 90 10000 75 75 12345 89 100 3456 98 34 36783 9038 6744 1838994 120 1300 54637 839 564 28399 12 1 2345 14 16 756 54 778 34533 983 756 123456 1000 3000 100000 5500 6000 1000000 100000 100000 1000000 2304 3450 600000 897 89 100000 5647 6575 1000000 823 4560 400000 65 76 1200 98 100 5000 5435 34738 99999 999 999 99999 1201 1633 20000 1 1 230 111 100 3000 302 2230 54673 123 321 3086 1 1 400 32 45 6758 90 465 5678 983 4567 123456 6537 8587 563656
样例输出
40320 5040 40320 1307674368000 6227020800 720 2432902008176640000 87178291200 355687428096000 720 87178291200 5040 2432902008176640000 39916800 362880 6227020800 6 20922789888000 39916800 6227020800 2432902008176640000 24 5040 6 3628800 24 1307674368000 120 39916800 24