403764: GYM101262 D Vera and Sorting

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Vera and Sortingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Vera is very smart and invented a new sorting algorithm. She coded the following python function to count how many steps her algorithm takes.


def steps(array):
if len(array) == 0:
return 0
pivot = array[0]
count = 0
lesser = []
greater = []
for element in array:
count += 1
if element < pivot:
lesser.append(element)
elif element > pivot:
greater.append(element)
return count + steps(lesser) + steps(greater)

A permutation P is an ordered set of integers P1, P2, ..., PN, consisting of N distinct positive integers, each of them doesn't exceed N. We'll call number N the size or the length of permutation.

You are given integers N and K.

Help Vera count the number of permutations P of size N such that steps(P) = K. This number could be large, so output it modulo 109 + 7.

Constraints:

1 ≤ N ≤ 30

1 ≤ K ≤ 900

N, K are integers

Input

The input will be in the format:

N K

Output

Output one integer, the number of possible permutations, modulo 109 + 7.

ExamplesInput
3 5
Output
2
Input
5 29
Output
0
Input
20 100
Output
262859528
Note

For the first example, the 2 valid permutations are 2, 1, 3 and 2, 3, 1.

加入题单

上一题 下一题 算法标签: