The Shortest Problem

5

1 votes
Problem

Everyone likes short and sweet problem statements and so here is one.

Given N and M, you need to find Mi=1N mod i2. Since the answer could be large, find it modulo 109+7.

Input

The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.

The first and only line of each test case contains two space-separated integers N and M.

 

Output

For each test case, print a single line containing one integer denoting the answer to the problem.

 

Constraints

1T50

Subtask 1 (10 points): 1N106,1M106

Subtask 2 (10 points): 1N1012,1M1018

Subtask 3 (80 points): 1N1018,1M1018

Problem Author: Ankit Kumar Singh

Time Limit: 2.5
Memory Limit: 256
Source Limit:
Editor Image

?