409607: GYM103643 J P=NP Revisited

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. P=NP Revisitedtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

After chessbot bugged PurpleCrayon for too long to share the proof for P=NP, PurpleCrayon decided to leave the team! Now he has to find good and original problem ideas and flavor text...

However, it seems that most participants from the last contest found $$$P=NP$$$ to be too easy, so chessbot has buffed the problem to be harder!

Define $$$F(x, y)$$$ as the total number of pairs $$$n, p$$$ $$$(0 \leq n \leq x, 0 \leq p \leq y)$$$ such that $$$p = n \cdot p$$$.

Chessbot wants you to find $$$\prod_{i = 1}^{N} \prod_{j = 1}^{P} F(i, j)$$$ for a given $$$N, P$$$. Since this number may be very large, please find it modulo $$$10^9 +7$$$.

Input

The first line containers an integer $$$T$$$ $$$(1 \leq T \leq 10^4)$$$. Each of the next $$$T$$$ lines contains two integers $$$N, P$$$ $$$(1 \leq N, P \leq 3 \cdot 10^5)$$$ corresponding product chessbot wants you to compute. It is guaranteed that the sum of $$$N$$$ does not exceed $$$3 \cdot 10^5$$$ and that the sum of $$$P$$$ does not exceed $$$3 \cdot 10^5$$$.

Output

Output $$$T$$$ lines, one integer per line, denoting the desired product modulo $$$10^9 +7$$$.

ExampleInput
3
1 1
2 2
33 66
Output
3
240
387366933
Note

$$$F(1, 1) = 3$$$ for pairs $$$(0, 0), (1, 0), (1, 1)$$$. So the answer for the first testcase is $$$3$$$.

$$$F(1, 1) = 3, F(2, 1) = 4, F(1, 2) = 4, F(2, 2) = 5$$$. The product for those $$$4$$$ numbers is $$$240$$$ which is the answer.

$$$---------------------------------------------$$$

Problem idea: 3366

Problem preparation: 3366

Occurrences: Novice 9, Intermediate 4

加入题单

上一题 下一题 算法标签: