QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 8 MB Total points: 100

#11851. Inversions

Statistics

A sequence $ x_{1}, x_{2}, \ldots, x_{n} $ of different integers is called a permutation of size $ n $ if $1 ≤ x_{i} ≤ n $ for every $1 ≤ i ≤ n $. For every permutation we define its inversions as pairs of indices $1 ≤ i < j ≤ n $ such that $ x_{i} > x_{j} $. Your task is to count the number of permutations of size $ n $, having a given number of inversions.

Write a program which:

  • reads from the standard input the size of the permutation and the number of inversions,
  • counts the number of permutations of the given size and having the given number of inversions,
  • writes the result to the standard output.

Input Format

The first and only line of input contains two integers $ n $ and $ k $ ($1 ≤ n ≤ 500$, $0 ≤ k ≤ n(n - 1)/2$), separated by a single space and representing the size of permutation and the number of inversions we are interested in.

Output Format

The first and only line of output should contain the remainder of the division of the number of the permutations we are interested in by 30 011.

Example

Input

3 2

Output

2

Notes

The permutations of size 3 which have 2 inversions are 2, 3, 1 and 3, 1, 2.