#P4240. 毒瘤之神的考验

毒瘤之神的考验

Description

The God of "Duliu" will ask TT times. Each time, given n,mn, m, Salamander must answer $\left( \sum_{i=1}^n \sum_{j=1}^m \varphi(ij) \right)\! \bmod 998244353$.

Salamander cannot solve it, so he passes the problem to you.

Input Format

The first line contains a positive integer TT.

Then follow TT lines; each line contains two positive integers separated by a space, representing this query's n,mn, m.

Output Format

Output TT lines, each containing one integer representing the answer.

3
1 1
2 2
3 3
1
5
19

Hint

For 40%40\% of the testdata, T=1T = 1, n,m105n, m \le 10^5.
For 50%50\% of the testdata, T103T \le 10^3, n,m105n, m \le 10^5.
For another 10%10\% of the testdata, T104T \le 10^4, n=m105n = m \le 10^5.
For 100%100\% of the testdata, 1T1041 \le T \le 10^4, 1n,m1051 \le n, m \le 10^5.

Translated by ChatGPT 5