Problem:
Score : 600 points

Problem Statement

Let us define the oddness of a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n} as \sum_{i = 1}^n |i - p_i|.

Find the number of permutations of {1,\ 2,\ ...,\ n} of oddness k, modulo 10^9+7.

Constraints

All values in input are integers.

1 \leq n \leq 50

0 \leq k \leq n^2

Input

Input is given from Standard Input in the following format:

n k

Output

Print the number of permutations of {1,\ 2,\ ...,\ n} of oddness k, modulo 10^9+7.

Sample Input 1

3 2

Sample Output 1

2

There are six permutations of {1,\ 2,\ 3}. Among them, two have oddness of 2: {2,\ 1,\ 3} and {1,\ 3,\ 2}.

Sample Input 2

39 14

Sample Output 2

74764168

Solution in Ruby (2.7.1) (judge verdict: Accepted)

M=10**9+7
N,K=gets.split.map(&:to_i)
if K.odd?
  p 0
  exit
end
dp=Array.new(N+1){Array.new(N+1){Array.new(K+N+1){0}}}
dp[0][0][0]=1
N.times do |i|
  N.times do |j|
    0.upto(K/2) do |k|
      dp[i][j][k] %= M
      # 新規同士で繋げる
      dp[i+1][j][k+j] += dp[i][j][k]
      # 片方だけ保留と繋げる
      dp[i+1][j][k+j] += 2 * j * dp[i][j][k]
      # 両方とも保留と繋げる
      dp[i+1][j-1][k+j-1] += j * j * dp[i][j][k] if 0<=j-1
      # 両方とも保留する
      dp[i+1][j+1][k+j+1] += dp[i][j][k]
    end
  end
end
p dp[N][0][K/2]%M