P21224 [CodeChef] CTHREE
提高-
题目描述

Read problems statements in Mandarin chinese, Russian and Vietnamese as well.

Today, Chef was trying to solve a problem he found pretty hard: Given an integer N and a triple of integers (a, b, c), compute the number of triples of positive integers (x, y, z) such that N = x · y · z, x ≤ a, y ≤ b and z ≤ c.

Can you help Chef solve this problem?

Two triples (x_{1}, y_{1}, z_{1}) and (x_{2}, y_{2}, z_{2}) differ if x_{1} is not equal to x_{2} or y_{1} is not equal to y_{2} or z_{1} is not equal to z_{2}.

------ Input ------

The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains four space-separated integers N, a, b and c.

------ Output ------

For each test case, print a single line containing one integer — the number of valid triples (x, y, z).

------ Constraints ------

$1 ≤ T ≤ 20$
$1 ≤ N ≤ 10^{9}$
$1 ≤ a, b, c ≤ 10^{6}$

----- Sample Input 1 ------
3
100 8 23 11
497296800 1000000 1000000 1000000
1 1 2 3
----- Sample Output 1 ------
10
97800
1
----- explanation 1 ------
Example case 1: There are 10 valid triples (x, y, z): (1, 10, 10), (1, 20, 5), (2, 5, 10), (2, 10, 5), (4, 5, 5), (5, 2, 10), (5, 4, 5), (5, 5, 4), (5, 10, 2), (5, 20, 1).

输入格式

见题面

输出格式

见题面

样例输入
3 100 8 23 11 497296800 1000000 1000000 1000000 1 1 2 3
样例输出
10 97800 1