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

开始时间Start Time
2021-12-05 18:00:00
结束时间End Time
2021-12-05 23:00:00
当前时间Current Time
2025-12-14 19:52:10
比赛状态Contest Status
比赛类型Contest Type
公开Public
榜单状态Rank Status

D (1160) : Sum Them

时间限制Time Limit 1 Sec 内存限制Memory Limit 128 MB 提交次数Submitted 130 Times 通过次数Solved 34 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