2525.Sum of Remainders

Time Limit: 1s Memory Limit: 256MB

Calculate the value of the sum: n mod 1 + n mod 2 + n mod 3 + ... + n mod m. As the result can be very large, you should print the value modulo 109+7 (the remainder when divided by 109+7).

The modulo operator a mod b stands for the remainder after dividing a by b. For example 10 mod 3 = 1.

Input Format(From the terminal/stdin)

The only line contains two integers n,m (1 \le n,m \le 1013) - the parameters of the sum.

Output Format(To the terminal/stdout)

Print integer s - the value of the required sum modulo 109+7.

Sample Input 1

Copy
3 4
 · \n

Sample Output 1

Copy
4
 \n

Sample Input 2

Copy
4 4
 · \n

Sample Output 2

Copy
1
 \n

Sample Input 3

Copy
1 1
 · \n

Sample Output 3

Copy
0
 \n

Submit

请先 登录

© 2025 FAQs