D. Distinct Token Arrangements
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Sergio must leave for an urgent matter, so he invents a game to keep his little brother Javier busy. In the game, Javier is given two kinds of tokens:

  • Unique tokens: There are $$$m$$$ tokens labeled from $$$1$$$ to $$$m$$$ (each token can be used at most once).
  • Zero tokens: There are $$$n$$$ tokens, all labeled $$$0$$$ (these tokens are identical; using one "$$$0$$$" is indistinguishable from another).

To finish the game Javier needs to create all the possible distinct arrangements.

An arrangement is defined as an ordered sequence of tokens of length $$$L$$$, where $$$1 \le L \le n$$$. In forming an arrangement you must obey these rules:

  • You may use a unique token at most once in any arrangement.
  • You may use the $$$0$$$ tokens as many times as needed (up to the arrangement's length; since you have exactly $$$n$$$ copies, no arrangement can have more than $$$n$$$ $$$0$$$ tokens).
  • Two arrangements are considered distinct if there exists an index $$$i$$$ such that the token in position $$$i$$$ of one arrangement is different from the token in position $$$i$$$ of the other.

Your task is to help Javier figure out how many arrangements he needs to create in order to finish the game. Because this number can be huge, output it modulo $$$10^9+7$$$.

Input

A single line containing two integers $$$m$$$ $$$(1 \le m \le 1000)$$$ and $$$n$$$ $$$(1 \le n \le 1000)$$$.

Output

Output a single line with one integer the number of distinct arrangements modulo $$$10^9 + 7$$$.

Example
Input
2 2
Output
10
Note

In the first case, if $$$m = 2$$$ and $$$n = 2$$$ the possible arrangements are:

  • Length 1: $$$[0], [1], [2]$$$
  • Length 2: $$$[0, 0], [0, 1],[1, 0],[0, 2],[2, 0],[1, 2],[2, 1]$$$
In total, there are 3 + 7 = 10 distinct arrangements.