#Lutece2495. An Easy Math Problem I

An Easy Math Problem I

Migrated from Lutece 2495 An Easy Math Problem I

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

给定 nn 这个正整数,计算下式的值

i=lrj=1if(i,j)\sum_{i=l}^{r}\sum_{j=1}^{i}f(i,j)

f(i,j)f(i,j) 表示 ij\frac{i}{j} 的小数部分。

Input

第一行有一个正整数 t (1t106)t\ (1\le t \le 10^6)

下面有 tt 组测试用例,每个测试用例包含两个正整数 l,r (1lr106)l,r\ (1\le l\le r\le 10^6)

Output

对于每个测试用例,输出一个整数表示该式子的值。

如果答案可以表示成 PQ\frac{P}{Q} 的形式,请输出 P×Q1mod998244353P\times Q^{-1}\bmod 998244353 的值,其中 Q1Q^{-1} 表示 QQ 在模 998244353998244353 意义下的乘法逆元。

Samples

1
1 3
499122177

Resources

2020 UESTC ICPC Training for Math and Geometry