#arc156e. [arc156_e]Non-Adjacent Matching
[arc156_e]Non-Adjacent Matching
Problem Statement
Find the number, modulo , of good sequences of length whose elements are integers between and , inclusive, and whose sum is at most .
Here, a length- sequence is said to be good if and only if there is a graph that satisfies all of the following conditions.
- is a graph with vertices numbered to without self-loops. (It may have multi-edges.)
- For each , the degree of vertex is .
- For each , no edge connects vertex and vertex . Here, vertex means vertex .
Constraints
- All numbers in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4 1 2
Sample Output 1
3
The following three sequences are good.
Sample Input 2
10 0 0
Sample Output 2
1
Sample Input 3
314 159 26535
Sample Output 3
248950743
Print the count modulo .