Description
Given n and m, calculate the sum of the incremental multiplication formulas:
f(n,m)=∑i=1n∏j=ii+m−1jf(n,m)=∑i=1n∏j=ii+m−1j
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 Input
2 2 98 3
Sample Output
8 24497550
Hint
Source
湖南省第十七届大学生计算机程序设计竞赛(HNCPC2021)
Author
CSGrandeur
include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long LL;
const LL N=1e9+7;
const int M=1e6+10;
LL inv[M];
int n,m;
void get_niyuan()
{
inv[0