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

开始 Start
0000-00-0000:00:00UTC+0
结束 End
0000-00-0000:00:00UTC+0
当前 Now
0000-00-0000:00:00UTC+0
状态 Status
加载中Loading
类型 Type
开放Public
榜单 Rank
加载中Loading
公告 Announcement
暂无公告No announcement

D : Sum Them

时间限制Time Limit
1 秒Sec
内存限制Memory Limit
128 兆MB
提交次数Submitted
130 次Times
通过次数Solved
34 次Times

题目描述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