#P1160. Sum Them

    ID: 161 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>湖南省第十七届大学生计算机程序设计竞赛(HNCPC2021)

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