#CODEFESTIVAL2017QUALBE. Popping Balls

Popping Balls

Score : 16001600 points

Problem Statement

A+BA + B balls are arranged in a row. The leftmost AA balls are colored red, and the rightmost BB balls are colored blue.

You perform the following operation:

  • First, you choose two integers s,ts, t such that 1s,tA+B1 \leq s, t \leq A + B.
  • Then, you repeat the following step A+BA + B times: In each step, you remove the first ball or the ss-th ball (if it exists) or the tt-th ball (if it exists, all indices are 1-based) from left in the row, and give it to Snuke.

In how many ways can you give the balls to Snuke? Compute the answer modulo 109+710^9 + 7.

Here, we consider two ways to be different if for some kk, the kk-th ball given to Snuke has different colors. In particular, the choice of s,ts, t doesn't matter. Also, we don't distinguish two balls of the same color.

Constraints

  • 1A,B20001 \leq A, B \leq 2000

Input

Input is given from Standard Input in the following format:

AA BB

Output

Print the answer.

3 3
20

There are 2020 ways to give 33 red balls and 33 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):

  • You choose s=3,t=4s = 3, t = 4.
  • Initially, the row looks like rrrbbb.
  • You remove 33rd ball (r) and give it to Snuke. Now the row looks like rrbbb.
  • You remove 44th ball (b) and give it to Snuke. Now the row looks like rrbb.
  • You remove 11st ball (r) and give it to Snuke. Now the row looks like rbb.
  • You remove 33rd ball (b) and give it to Snuke. Now the row looks like rb.
  • You remove 11st ball (r) and give it to Snuke. Now the row looks like b.
  • You remove 11st ball (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 7070 ways to give 44 red balls and 44 blue balls. Among them, only bbrrbrbr, brbrbrbr, and brrbbrbr are impossible.

7 9
7772
1987 1789
456315553