#arc117e. [arc117_e]Zero-Sum Ranges 2
[arc117_e]Zero-Sum Ranges 2
Problem Statement
How many different sequences of length , , satisfy both of the following conditions?
- The sequence contains occurrences of and occurrences of .
- There are exactly pairs of and such that .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of different sequences that satisfy the conditions in Problem Statement. The answer always fits into the signed -bit integer type.
Sample Input 1
1 1
Sample Output 1
2
For , two sequences below satisfy the conditions:
Sample Input 2
2 3
Sample Output 2
2
For , two sequences below satisfy the conditions:
Sample Input 3
3 7
Sample Output 3
6
For , six sequences below satisfy the conditions:
Sample Input 4
8 24
Sample Output 4
568
Sample Input 5
30 230
Sample Output 5
761128315856702
Sample Input 6
25 455
Sample Output 6
0
For , no sequences satisfy the conditions.