题目描述
Problem Description
Indeed Corporation's employee, Mr. A, is gazing at an infinitely expanding equilateral triangular coordinate system. The coordinates are represented in the form of $(x, y)$, where $x$ denotes the row from the top and $y$ denotes the position from the left in that row, arranged as follows:
(1,1)(2,1)(2,2)(3,1)(3,2)(3,3)(4,1)(4,2)(4,3)(4,4):::
In this coordinate system, the $k$-th row contains $k$ coordinates.
The weight of a coordinate $(x, y)$ is defined as the product of $x$ and $y$.
Mr. A is trying to solve the following problem by finding a pattern:
Given two positive integers $A, B\ (1 \leq A \leq B \leq 10^6)$, find the sum of the weights of all coordinates $(x, y)$ that satisfy $A \leq x \leq B$. Since the answer can be very large, output the sum modulo $1,000,000,007 (10^9 + 7)$.
Your task is to create a program that uses the power of a computer to automatically calculate the answer in advance to verify whether Mr. A's derived answer is correct.
Input Format
The input is given from the standard input in the following format:
$A$ $B$
- The first line contains a positive integer $A\ (1 \leq A \leq 10^6)$.
- The second line contains a positive integer $B\ (A \leq B \leq 10^6)$.
Output Format
Output a single line containing the sum of the weights of all coordinates $(x, y)$ that satisfy $A \leq x \leq B$ modulo $1,000,000,007$. Ensure to include a newline at the end of the output.
Sample Input and Output
Sample Input #1
2
3
Sample Output #1
24
Sample Input #2
1
100
Sample Output #2
12920425
Sample Input #3
999999
999999
Sample Output #3
500507028
Notes/Hints
Partial Points
This problem has partial scoring:
- If you solve the dataset where $1 \leq A \leq B \leq 2000$ correctly, you will be awarded 20 points.
- If you solve all test cases correctly, you will be awarded an additional 80 points.
Sample Explanation 1
The coordinates included between the 2nd and 3rd rows are as follows: (2,1)(2,2)(3,1)(3,2)(3,3). Therefore, the answer is $24 (= 2 \times 1 + 2 \times 2 + 3 \times 1 + 3 \times 2 + 3 \times 3)$.
Sample Explanation 3
Do not forget to take the modulo $1,000,000,007$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分