#P1552. Bash Plays with Functions

Bash Plays with Functions

描述

Bash got tired on his journey to become the greatest Pokemon master. So he decides to take a break and play with functions.

Bash defines a function f0(n)f_0(n), which denotes the number of ways of factoring nn into two factors pp and qq such that gcd(p,q)=1gcd(p, q) = 1. In other words, f0(n)f_0(n) is the number of ordered pairs of positive integers (p,q)(p, q) such that pq=np·q = n and gcd(p,q)=1gcd(p, q) = 1.

But Bash felt that it was too easy to calculate this function. So he defined a series of functions, where fr+1f_r + 1 is defined as: Where (u,v)(u, v) is any ordered pair of positive integers, they need not to be co-prime.

Now Bash wants to know the value of fr(n)f_r(n) for different rr and nn. Since the value could be huge, he would like to know the value modulo 109+7.10^9 + 7. Help him!

中文题意

定义f0(n)f_0(n)pq=npq=n(pq=1)(pq=1)(pq)(pq)对数。 定义: qq次询问,每次回答fr(n)(mod109+7)f_r(n)(mod 10^9+7). 数据范围: nrq106n,r,q,\le 10^6

输入

The first line contains an integer q(1q106)q (1 ≤ q ≤ 10^6) — the number of values Bash wants to know.

Each of the next qq lines contain two integers rr and n(0r106,1n106),n (0 ≤ r ≤ 10^6, 1 ≤ n ≤ 10^6), which denote Bash wants to know the value fr(n)f_r(n).

输出

Print qq integers. For each pair of rr and nn given, print fr(n)f_r(n) modulo 109+7109^ + 7 on a separate line.

样例

5
0 30
1 25
3 65
2 5
4 48

8
5
25
4
630