| BSUIR Open XIII: School final |
|---|
| Finished |
Madoka has already finished writing the municipal stage in Novosibirsk and went home to wait for the results of the closed testing.
At the olympiad, there was exactly one problem — given a permutation of numbers from $$$1$$$ to $$$n$$$: $$$p_1, p_2, \ldots, p_n$$$. It is necessary to find out the minimum number of times one can swap adjacent elements to sort the permutation in ascending order. However, Madoka solved it as follows: $$$k + \frac{|1 - p_1| + |2 - p_2| + \ldots + |n - p_n|}{2}$$$.
But since the jury knows who Madoka's father is, in order not to lose their job, they must create tests such that Madoka's solution is correct. Therefore, they became interested in how many permutations of length $$$n$$$ exist for which Madoka's solution will yield the correct answer to the problem, but since the answer may be too large, output it modulo $$$10^9 + 7$$$.
Two numbers $$$n, k$$$ are given in a single line separated by a space ($$$2 \leq n \leq 17$$$, $$$0 \leq k \leq 50$$$).
In a single line, print exactly the number — the number of permutations of length $$$n$$$ modulo $$$10^9 + 7$$$ for which the minimum number of swaps of neighboring elements for sorting is $$$k + \frac{|1 - p_1| + |2 - p_2| + \ldots + |n - p_n|}{2}$$$.
3 1
1
3 0
5
4 0
14
In the first example, only the permutation $$$3, 2, 1$$$ is suitable, for it the minimum number of swaps is — $$$3$$$, and Madoka's answer is — $$$\frac{|1 - 3| + |2 - 2| + |3 - 1|}{2} + 1=2 + 1 = 3$$$.
| Name |
|---|


