2444... 4 ways!

You are given $n$ "2"s and $m$ "4"s. Determine how many distinct numbers you can get by rearranging the digits. As the answer can be quite large, output it modulo $10^9 + 7$.

Note

This is also known as the Stars and Bars problem: You have $n$ stars and $m+1$ groups, and you want to find how many different ways there are to put the stars into groups. This problem is equivalent to having $m$ bars instead, to separate stars into their groups.

Input

The first line consists of two integers $n$ and $m$.

Output

Output an integer, the answer modulo $10^9 + 7$.

Constraints

For all testcases: $0 \le n, m \le 10^6$
Subtask 1 (50%): $n, m \le 1000$
Subtask 2 (50%): No other constraints

Hint

Consider the total number of positions you can put digits on. You can get a number by choosing $n$ positions from them to be "2"s, and the rest be "4"s. Are the numbers found in this way distinct?

Sample Test Cases

Input Output
1 3 4
Click to copy.

Scoring: Per Subtask
Authored by s17f18
Appeared in 2024 Mini Contest 4