P8786 [Lanqiao Cup 2022 Provincial B] Li Bai Buys Wine (Enhanced Version).

Description

It is said that the great poet Li Bai loved drinking all his life. Luckily, he never drove. One day, he carried a wine pot and left home. There were $2$ dou of wine in the pot. As he walked, he sang: > Walking on the street with nothing to do, carrying the pot to buy wine. > When he meets a shop, the amount doubles; when he meets flowers, he drinks one dou. Along the way, he met shops $N$ times and met flowers $M$ times. It is known that the last thing he met was flowers, and he drank the wine exactly to $0$. Please compute how many different possible orders of meeting shops and flowers there are on this trip. Note: It is allowed to meet a shop when there is no wine in the pot ($0$ dou). After doubling, it is still $0$. However, it is not allowed to meet flowers when there is no wine.

Input Format

The first line contains two integers $N$ and $M$.

Output Format

Output one integer representing the answer. Since the answer may be very large, output it modulo $1000000007$ (i.e. $10^9+7$).

Explanation/Hint

**Sample Explanation** If we use `0` to represent meeting flowers and `1` to represent meeting a shop, the $14$ possible orders are as follows: ```plain 010101101000000 010110010010000 011000110010000 100010110010000 011001000110000 100011000110000 100100010110000 010110100000100 011001001000100 100011001000100 100100011000100 011010000010100 100100100010100 101000001010100 ``` **Constraints and Notes** For $40\%$ of the testdata: $1 \leq N, M \leq 10$. For $100\%$ of the testdata: $1 \leq N, M \leq 100$. Lanqiao Cup 2022 Provincial Contest B Group, Problem I. Translated by ChatGPT 5