#nt903. 互质数对

互质数对

Coprime Pairs

Problem Description

There are TT queries. Each query gives two numbers n,mn, m; find the number of pairs (i,j)(i, j) such that 1≤i≤n1 \leq i \leq n, 1≤j≤m1 \leq j \leq m and i,ji, j are coprime.

Input Format

The first line contains an integer TT. The following TT lines each contain two integers n,mn, m.

Output Format

Output TT lines, each containing one number: the answer.

Sample Input

3
100 200
1000 2000
1000000 2000000

Sample Output

12203
1216677
1215854454422

Constraints

For all data, 1≤T≤10001 \leq T \leq 1000, 1≤n,m≤1071 \leq n, m \leq 10^7.