#D11411. Grid Number
Grid Number
Grid Number
F: Grid number
problem
Ebi-chan is trying to write exactly one integer from 1 to 2 \ times n in a grid with n columns horizontally and 2 rows vertically.
Only one integer can be written to each cell in the grid.
It's not fun just to write normally, so I set the following rules.
- The absolute value of the difference between the integers written in two adjacent cells is less than or equal to k.
- When there is a cell to the right of a cell, the integer written to the cell is truly smaller than the integer written to the cell to the right.
- When there is a cell under a cell, the integer written in the cell is truly smaller than the integer written in the cell below.
Here, two adjacent squares represent squares that share the top, bottom, left, and right sides with a certain square.
How many ways to write this? The answer can be very large, so print the remainder after dividing by the prime number m.
Supplement
The second and third rules above require you to write an integer so that it doesn't violate the inequality sign, as shown in the figure below.
Input format
You will be given three integers as input.
n k m
Constraint
- 1 \ leq n \ leq 100
- 1 \ leq k \ leq 10
- 2 \ leq m \ leq 10 ^ 9 + 7
- m is a prime number
Output format
Please output the number on one line according to how to write the number. Also, be careful not to forget the trailing line break.
Input example 1
3 2 7
Output example 1
1
- The above writing method meets the conditions, and there is no other writing method that meets the conditions.
Input example 2
5 10 11
Output example 2
9
- Output the remainder divided by m.
Example
Input
3 2 7
Output
1
inputFormat
Input format
You will be given three integers as input.
n k m
Constraint
- 1 \ leq n \ leq 100
- 1 \ leq k \ leq 10
- 2 \ leq m \ leq 10 ^ 9 + 7
- m is a prime number
outputFormat
Output format
Please output the number on one line according to how to write the number. Also, be careful not to forget the trailing line break.
Input example 1
3 2 7
Output example 1
1
- The above writing method meets the conditions, and there is no other writing method that meets the conditions.
Input example 2
5 10 11
Output example 2
9
- Output the remainder divided by m.
Example
Input
3 2 7
Output
1
样例
3 2 7
1