| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| PSUT Marathon 2025 |
|---|
| Finished |
This contest uses time limits scaling policy (depending on a programming language). The system automatically adjusts time limits by the following multipliers for some languages. Despite scaling (adjustment), the time limit cannot be more than 30 seconds. Read the details by the link.
Welcome to the Mario Elite League!
You're preparing your kart for the upcoming races, the kart has $$$n$$$ item slots.
Mario Elite League Each slot $$$i$$$ must be filled with an item of "Power Level" $$$A_i$$$.
To achieve peak performance, the array of Power Levels $$$[A_1, A_2, \dots, A_n]$$$ must satisfy the following conditions based on their combined effects:
Given integers $$$n, g, l$$$, Mario wants to count the number of distinct arrays $$$[A_1, A_2, \dots, A_n]$$$ satisfying these conditions.
Since the number of such arrays can be very large, output the answer modulo $$$10^9 + 7$$$.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The only line in each test case contains four space-separated integers $$$n$$$ ($$$1 \le n \le 10^6$$$), $$$g, l$$$ ($$$1 \le g, l \le 10^{12}$$$) — the number of items, the gcd, and the lcm respectively.
It's guaranteed that the sum of $$$g, l$$$ over all test cases does not exceed $$$1 \cdot 10^{12}$$$.
For each test case, Print a single integer, the number of valid arrays modulo $$$10^9 + 7$$$.
32 2 63 1 46 6 24
2 12 602
| Name |
|---|

