D. 好對 Good Pair

Memory limit: 256 MiB Time limit: 1000 ms Input file: stdin Output file: stdout
Problem type: traditional Judging mode: text compare

Description

給定一個由正整數 a_1, a_2, \ldots, a_n 組成的數組。對於下標 i ,若 1 \leq i < n a_{i+1}-a_{i} = 1 ,則稱 (i, i+1) 是一個好對

現在請你計算 [1, 2, \ldots, N] 的排列中,恰好有 K 個好對的個數。由於這個數可能非常大,輸出對 P 取模的結果。


For an array a_1, a_2, \ldots, a_n of positive integers, a good pair refers to a pair of indices (i, i+1) where 1 \leq i < n and a_{i+1} - a_i = 1 .

Find the number of permutations of [1, 2, \ldots, N] with exactly K good pairs. As this number can be very big, output it modulo prime P .

Input

輸入包含三個整數 N K P


The input consists of three integers, N , K , and P .

Output

輸出一個整數,表示 [1, 2, \ldots, N] 的排列中,恰好有 K 個好對的個數,對 P 取模。


Output exactly one integer, the number of permutations of [1, 2, \ldots, N] with exactly K good pairs modulo P .

Sample

Sample 1 input

3 1 1000000007

Sample 1 output

2

Sample 2 input

4 0 1000000007

Sample 2 output

11

Sample explanation

樣例 1︰ [1, 2, 3] 的排列中,恰好有 1 個好對的是︰ [2, 3, 1] [3, 1, 2]

Example 1: The permutations of [1, 2, 3] that have exactly 1 good pairs are [2, 3, 1] and [3, 1, 2] .

Constraint and hint

對於全部測試數據,滿足: 1 \leq N \leq 10^6 0 \leq K \leq N - 1 10^8 \leq P \leq 10^9 + 7 P 是一個質數。

子任務 分數 附加限制
1 11 N \leq 8
2 14 N \leq 14
3 23 N \leq 2000
4 27 K = 0
5 25 無附加限制

For all test data, 1 \leq N \leq 10^6 , 0 \leq K \leq N - 1 , 10^8 \leq P \leq 10^9 + 7 .

P is a prime number.

Subtask Score Additional Constraints
1 11 N \leq 8
2 14 N \leq 14
3 23 N \leq 2000
4 27 K = 0
5 25 No additional constraints