#P8786. [蓝桥杯 2022 省 B] 李白打酒加强版

[蓝桥杯 2022 省 B] 李白打酒加强版

Problem 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 22 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 NN times and met flowers MM times. It is known that the last thing he met was flowers, and he drank the wine exactly to 00.

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 (00 dou). After doubling, it is still 00. However, it is not allowed to meet flowers when there is no wine.

Input Format

The first line contains two integers NN and MM.

Output Format

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

5 10
14

Hint

Sample Explanation

If we use 0 to represent meeting flowers and 1 to represent meeting a shop, the 1414 possible orders are as follows:

010101101000000
010110010010000
011000110010000
100010110010000
011001000110000
100011000110000
100100010110000
010110100000100
011001001000100
100011001000100
100100011000100
011010000010100
100100100010100
101000001010100

Constraints and Notes

For 40%40\% of the testdata: 1N,M101 \leq N, M \leq 10.

For 100%100\% of the testdata: 1N,M1001 \leq N, M \leq 100.

Lanqiao Cup 2022 Provincial Contest B Group, Problem I.

Translated by ChatGPT 5