Logo
(追記) (追記ここまで)

19138번 - GCD vs LCM 다국어

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

문제

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

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 3: Chinese Contest E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /