luogu#P4902. 乘积

乘积

Background

A problem by CYJian after multiple rounds of strengthening.

Problem Description

Given A,BA, B, find the value of the following expression:

$$\prod_{i=A}^{B}\prod_{j=1}^{i}\left(\frac{i}{j}\right)^{\left\lfloor \frac{i}{j} \right\rfloor}\bmod 19260817$$

There are TT queries.


It is said that many people cannot understand the formula.

Alright, here is the pseudocode:

for i = A to B
  for j = 1 to i
    res = res * power(i / j, floor(i / j))
res = solve(res)

The final solve means converting it into the form of a fraction modulo.

It is not guaranteed that the precision will not blow up on the spot.

Input Format

The first line contains a positive integer TT.

The next TT lines each contain two positive integers, representing A,BA, B for this query.

Output Format

Output TT lines. Each line contains one positive integer, the answer for that query.

1
1 3

162

Hint

Sample explanation: $1 \times 4 \times 1 \times 27 \times \frac{3}{2} \times 1 \equiv 162 \pmod{19260817}$.

This problem uses bundled tests.

Constraints T=T = ABA \le B \le
151 \sim 5 11 50005000
6106 \sim 10 10610^6
111511 \sim 15 10610^6 50005000
162016 \sim 20 10610^6

Translated by ChatGPT 5