CSG-CPC
Online Judge

1013: 湖南省第十七届大学生计算机程序设计竞赛(HNCPC2021) - Semilive

Start Time:2021-12-05 18:00:00   End Time:2021-12-05 23:00:00   Current Time:2025-07-04 15:23:13   Public    Ended

D (1160) : Sum Them

         Time Limit: 1 Sec     Memory Limit: 128 MB     Submitted: 130     Solved: 34    

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

2 2
98 3
8
24497550

Hint