시간 제한메모리 제한제출정답맞힌 사람정답 비율
2.5 초 512 MB318833.333%

문제

bobo is good at GCD (greatest common divisor) and LCM (least common multiple).

But today he gets stuck in summing up $\mathrm{lcm}(i, j)$ for all $1 \leq i \leq n, 1 \leq j \leq m$ with $\gcd(i, j) \leq a$, modulo $(10^9 + 7)$.

입력

The first line contains an integer $q$, which denotes the number of questions ($1 \leq q \leq 10^4$).

Each of the following $q$ lines contains $3$ integers $n, m, a$, as described in the statement ($1 \leq n, m, a \leq 10^5$).

출력

For each question, print a single integer denoting the sum.

예제 입력 1

2
2 2 1
3 4 2

예제 출력 1

5
45