#P7857. Absolute Math

Absolute Math

Absolute Math

Problem Description

Let f(n)=dnμ(d)f(n)=\sum_{d|n} |\mu(d)|, where μ(d)\mu(d) is Mobius function . Output i=1mf(ni)\sum_{i=1}^m f(ni).

Input

The first line contains an integer T(1T104)T(1\leq T\leq 10^4) - the number of test cases. Each line of the following TT lines contains two integers n,m(1n,m107)n,m (1\leq n,m \leq 10^7).

Output

Print the answer modulo 109+710^9+7 for each test case.

Sample Input

3
6 3
6 2
1 4

Sample Output

12
8
7

Source

2020 Multi-University Training Contest 9