Problem: 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), which denotes the number of ways of factoring n into two factors p and q such that gcd(p, q) = 1. In other words, f0(n) is the number of ordered pairs of positive integers (p, q) such that p·q = n and gcd(p, q) = 1.

But Bash felt that it was too easy to calculate this function. So he defined a series of functions, where fr + 1 is defined as:

<image>

Where (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) for different r and n. Since the value could be huge, he would like to know the value modulo 109 + 7. Help him!

Input

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

Each of the next q lines contain two integers r and n (0 ≤ r ≤ 106, 1 ≤ n ≤ 106), which denote Bash wants to know the value fr(n).

Output

Print q integers. For each pair of r and n given, print fr(n) modulo 109 + 7 on a separate line.

Example

Input

5
0 30
1 25
3 65
2 5
4 48


Output

8
5
25
4
630

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long modx(long long Base, long long exponent) {
  long long ans = 1;
  if (Base == 1) return Base;
  while (exponent) {
    if (exponent & 1) ans = (ans * Base) % 1000000007;
    Base = (Base * Base) % 1000000007;
    exponent = exponent >> 1;
  }
  return ans;
}
long long inmodx(long long num) { return (modx(num, 1000000007 - 2LL)); }
struct node {
  node() {}
};
bool cmp() { return false; }
const int N = 1000009;
vector<int> p;
bool isp[N];
int sz_p;
vector<int> fact[N];
void sieve() {
  int i, j, cnt, x;
  isp[0] = isp[1] = 1;
  for (i = (2); i < (1005); i++) {
    if (!isp[i]) {
      for (j = i + i; j < N; j += i) isp[j] = 1;
    }
  }
  p.push_back(2);
  for (i = 3; i < N; i += 2) {
    if (!isp[i]) p.push_back(i);
  }
  sz_p = (int)((p).size());
  for (i = (0); i < (sz_p); i++) {
    for (j = p[i]; j < N; j += p[i]) {
      cnt = 0;
      x = j;
      while (x % p[i] == 0) {
        x /= p[i];
        cnt++;
      }
      fact[j].push_back(cnt);
    }
  }
}
long long factor[N + 50], ifact[N + 50];
void factorial() {
  int i;
  factor[0] = ifact[0] = 1LL;
  for (i = (1); i < (N + 50); i++) {
    factor[i] = (factor[i - 1] * ((long long)(i))) % 1000000007;
    ifact[i] = inmodx(factor[i]);
  }
}
long long comb(int n, int r) {
  if (n < 0 || r < 0 || r > n) return 0LL;
  long long ans = (factor[n] * ifact[r]) % 1000000007;
  ans = (ans * ifact[n - r]) % 1000000007;
  return ans;
}
int main() {
  sieve();
  factorial();
  int t, n, r, i, j, y;
  long long ans, sum;
  scanf("%d", &(t));
  while (t--) {
    scanf("%d", &(r));
    scanf("%d", &(n));
    ans = 1LL;
    if (r == 0)
      ans = modx(2LL, (long long)(int)((fact[n]).size()));
    else {
      for (i = (0); i < ((int)((fact[n]).size())); i++) {
        y = fact[n][i];
        sum = (comb(y + r, r) + comb(y + r - 1, r));
        if (sum >= 1000000007) sum -= 1000000007;
        ans = (ans * sum) % 1000000007;
      }
    }
    printf("%lld\n", (ans));
  }
  return 0;
}