#P6195. [EER1] 迫害

[EER1] 迫害

Description

There are kk people, and X wants to persecute these kk people.

Each of these kk people has a number, from 11 to kk.

X has n+mn + m numbers: nn of them are 11, and the other mm numbers have values that X can choose (once each number is fixed, it cannot be changed).

X can persecute a person if and only if he can choose some of the numbers in his hand whose sum equals that person's number. If so, the persecution succeeds. (The numbers are not consumed.)

Since X has great power and is very evil, he wants to carry out the persecutions starting from person 11, one by one.

Since Little Z is also among those being persecuted, he is very nervous and wants you to tell him: starting from the first person, what is the maximum number of consecutive people X can persecute?

Because there are too many persecuted people, please output the answer modulo 10000000071000000007.

Input Format

The first line contains two integers n,mn, m, meaning X has nn numbers equal to 11, and mm numbers whose values can be chosen.

Output Format

Tell Little Z how many people X can persecute.

1 2
7
2 2
11

Hint

Sample 1 Explanation

X chooses two numbers as 22 and 44. It can be seen that he can persecute 77 people consecutively.

Sample 2 Explanation

X chooses two numbers as 33 and 66. It can be seen that he can persecute 1111 people consecutively.


Constraints

This problem uses bundled testdata.

  • Subtask 1 (50 points): 1n51 \le n \le 5, 1m51 \le m \le 5.
  • Subtask 2 (30 points): It is guaranteed that the answer is within 101810^{18} before taking modulo.
  • Subtask 3 (20 points): No special restrictions.

For 100%100\% of the testdata, 1n1061 \le n \le 10^6, 1m1091 \le m \le 10^9.

Translated by ChatGPT 5