play-with-numbers
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Alice has just learned multiplying two integers. He wants to multiply two integers X and Y to form a number Z. To make the problem interesting he will choose X in the range [1,M] and Y in the range [1,N]. Help him to find the number of ways in which he can do this.

Input

First line of the input is the number of test cases T. It is followed by T lines. Each test case contains 3 numbers. ith number denotes the island number to which island i leads to.

Output

For each test case print a single number the required answer.

Constraints

1 ≤ T ≤ 10 

1 ≤ N ≤ 10^6

SAMPLE INPUT
4
4 7 9
5 2 10
5 5 6
2 8 1

SAMPLE OUTPUT
3
1
2
1