测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A10223. The Sum of the k-th Powers

编程题 普及/提高-

题目描述

There are well-known formulas: ![](/uploads/luogu/CF622F/5be9498766c9d969e3a6760cab8032bf2e4516ad_42517693acde.png), ![](/uploads/luogu/CF622F/136a02961e04e3ae077df756f5b50353eb1651d8_211acaee0477.png), ![](/uploads/acgo/image/4c49e7b458ec3741_49399d3e213d.jpeg). Also mathematicians found similar formulas for higher degrees.

Find the value of the sum ![](/uploads/acgo/image/5eae8d216bf1a07f_c582f313f006.jpeg) modulo $10^{9}+7$ (so you should find the remainder after dividing the answer by the value $10^{9}+7$ ).

输入格式

The only line contains two integers $n,k$ ( $1<=n<=10^{9},0<=k<=10^{6}$ ).

输出格式

Print the only integer $a$ — the remainder after dividing the value of the sum by the value $10^{9}+7$ .

输入输出样例

输入 #1
4 1
输出 #1
10
输入 #2
4 2
输出 #2
30
输入 #3
4 3
输出 #3
100
输入 #4
4 0
输出 #4
4
上一题 去做题 下一题