QOJ.ac

QOJ

Limite de temps : 5 s Limite de mémoire : 512 MB Points totaux : 100 Difficulté: [afficher]

#2586. Old Problem

Statistiques

Time flies, and in the blink of an eye, another year has passed...

This is the second time student Xiao Q is participating in the provincial team selection contest. This year, Xiao Q has learned his lesson; instead of risking stealing the exam questions, he is improving his skills by practicing old exam questions. However, there are too many old questions, and although Xiao Q works on them day and night, he cannot see the light at the end of the tunnel.

One day, exhausted from overworking, Xiao Q fell asleep and dreamed that he encountered a problem in the exam hall that he felt he had solved before, but he could not remember how he had solved it. He still felt a lingering fear even after waking up.

Xiao Q frowned, sensing that something was wrong, so he came to you, hoping you could teach him how to solve this problem. Xiao Q vaguely remembers that the problem asks to calculate the value of the following expression:

$$\left( \sum_{i=1}^{A} \sum_{j=1}^{B} \sum_{k=1}^{C} d(ijk) \right) \pmod{10^9 + 7}$$

where $d(ijk)$ denotes the number of divisors of $ijk$.

Input

The first line contains a positive integer $T$, representing the number of test cases.

The next $T$ lines each describe a test case, containing three integers $A, B,$ and $C$, with meanings as described in the problem statement.

Output

For each test case, output a single line containing an integer representing the value of the requested expression.

Examples

Input 1

5
10 10 10
100 100 100
1000 1000 1000
10000 10000 10000
100000 100000 100000

Output 1

11536
51103588
165949340
19234764
176764584

Notes

For 30% of the data, $1 \le A, B, C \le 5000$.

For 100% of the data, $1 \le T \le 10, 1 \le A, B, C \le 10^5, 1 \le \sum \max(A, B, C) \le 2 \cdot 10^5$.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.