题目描述
Problem Description
There are $ A + B $ balls arranged in a row. The leftmost $ A $ balls are red, and the rightmost $ B $ balls are blue.
You perform the following operations:
- First, choose integers $ s, t $ such that $1 \leq s, t \leq A + B$.
- Then, repeat the following steps $ A + B $ times: In each step, you choose the first ball from the left, or the $ s $-th ball (if it exists), or the $ t $-th ball (if it exists, all 1-based) and give it to Snuke.
How many ways can you give the balls to Snuke? Find the answer modulo $ 10^9 + 7 $.
Here, two methods are considered different if, for some integer $ k $, the color of the $ k $-th ball given to Snuke is different. Notably, the choice of $ s, t $ does not matter. Also, two balls of the same color are indistinguishable.
Input Format
The input is given from the standard input in the following format:
$ A $ $ B $
Output Format
Output the answer.
Sample Input and Output
Sample Input #1
3 3
Sample Output #1
20
Sample Input #2
4 4
Sample Output #2
67
Sample Input #3
7 9
Sample Output #3
7772
Sample Input #4
1987 1789
Sample Output #4
456315553
Notes/Hints
Constraints
- $1 \leq A, B \leq 2000$
Sample Explanation 1
There are $ 20 $ ways to give $ 3 $ red balls and $ 3 $ blue balls. It can be seen that all these methods are possible. Here is an example of the operation (r represents red, b represents blue): - Choose $ s = 3, t = 4 $. - Initially, the row is rrrbbb. - Remove the $ 3 $-th ball (r) and give it to Snuke. The row is now rrbbb. - Remove the $ 4 $-th ball (b) and give it to Snuke. The row is now rrbb. - Remove the $ 1 $-st ball (r) and give it to Snuke. The row is now rbb. - Remove the $ 3 $-th ball (b) and give it to Snuke. The row is now rb. - Remove the $ 1 $-st ball (r) and give it to Snuke. The row is now b. - Remove the $ 1 $-st ball (b) and give it to Snuke. The row is now empty. In this method, Snuke receives the balls in the order rbrbrb.
Sample Explanation 2
There are $ 70 $ ways to give $ 4 $ red balls and $ 4 $ blue balls. Among them, only bbrrbrbr, brbrbrbr, brrbbrbr are impossible.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分