#P1160. Sum Them
Sum Them
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.
2 2
98 3
8
24497550