1160 : Sum Them

时间限制Time Limit 1 Sec 内存限制Memory Limit 128 MB 提交次数Submitted 1610 Times 通过次数Solved 483 Times 标准评测Standard Judge

题目描述Description

Given n and m, calculate the sum of the incremental multiplication formulas:

$$ f(n, m)=\sum_{i=1}^{n}\prod_{j=i}^{i+m-1}j $$

输入格式Input

No more than 50 test cases. Each case one line, including integer n and m.

1 ≤ n, m ≤ 106.

输出格式Output

For each test case, output the result of f(n, m) modulo 109 + 7.

样例Sample

出题Author

CSGrandeur