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

开始 Start
 
结束 End
 
当前 Now
 
状态 Status
类型 Type
公开Public
榜单 Rank
公告 Announcement
暂无公告No announcement

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