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
1≤T≤50
Subtask 1 (10 points): 1≤N≤106,1≤M≤106
Subtask 2 (10 points): 1≤N≤1012,1≤M≤1018
Subtask 3 (80 points): 1≤N≤1018,1≤M≤1018
Problem Author: Ankit Kumar Singh