Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official.
×

Want to solve the contest problems after the official contest ends? Just register for practice and you will be able to submit solutions.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
F. The Sum of the k-th Powers

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThere are well-known formulas: , , . Also mathematicians found similar formulas for higher degrees.

Find the value of the sum modulo 10^{9} + 7 (so you should find the remainder after dividing the answer by the value 10^{9} + 7).

Input

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

Output

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

Examples

Input

4 1

Output

10

Input

4 2

Output

30

Input

4 3

Output

100

Input

4 0

Output

4

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/20/2021 00:31:07 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|