P13833 [CodeChef] equatio
提高-
题目描述

xy = a + blcm(x,y) + c*gcd(x,y)
It's easy: you are to write a program which for given a, b and c finds the number of pairs of positive integers (x, y) satisfying this equation.

Here * stands for multiplication, gcd(x,y) stands for the greatest common divisor of x and y, while lcm(x,y) stands for the least common multiple of x and y.

Input
The first line of the input file contains one integer T -- the number of test cases (no more than 10). Each of the next T lines contains exactly three space-separated integers a, b and c (0 ≤ a, b, c ≤ 10^6).

Output
For each test case output one line containing the sought number of solutions to the equation. If there is an infinite number of solutions, output -1 instead.

Example

Input:
3
2 1 1
160 0 90
300 7 5

Output:
2
8
4

Explanation:

In the first test case, the only pairs are (2,4) and (4,2).

输入格式

见题面

输出格式

见题面

样例输入
3 2 1 1 160 0 90 300 7 5
样例输出
2 8 4