Score : 1600 points
A + B balls are arranged in a row. The leftmost A balls are colored red, and the rightmost B balls are colored blue.
You perform the following operation:
In how many ways can you give the balls to Snuke? Compute the answer modulo 10^9 + 7.
Here, we consider two ways to be different if for some k, the k-th ball given to Snuke has different colors. In particular, the choice of s, t doesn't matter. Also, we don't distinguish two balls of the same color.
Input is given from Standard Input in the following format:
A B
Print the answer.
3 3
20
There are 20 ways to give 3 red balls and 3 blue balls. It turns out that all of them are possible.
Here is an example of the operation (r
stands for red, b
stands for blue):
rrrbbb
.r
) and give it to Snuke. Now the row looks like rrbbb
.b
) and give it to Snuke. Now the row looks like rrbb
.r
) and give it to Snuke. Now the row looks like rbb
.b
) and give it to Snuke. Now the row looks like rb
.r
) and give it to Snuke. Now the row looks like b
.b
) and give it to Snuke. Now the row is empty.This way, Snuke receives balls in the order rbrbrb
.
4 4
67
There are 70 ways to give 4 red balls and 4 blue balls.
Among them, only bbrrbrbr
, brbrbrbr
, and brrbbrbr
are impossible.
7 9
7772
1987 1789
456315553