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 C++14 (GCC 5.4.1) (judge verdict: Accepted)

/*
  mail: mleautomaton@foxmail.com
  author: MLEAutoMaton
  This Code is made by MLEAutoMaton
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=60,Mod=1e9+7;
int f[N][N][N*N],n,k;
void Add(int &x,int y){x+=y;if(x>=Mod)x-=Mod;}
int main(){
	n=gi();k=gi();
	if(k%2)return puts("0"),0;
	f[1][0][0]=f[1][1][0]=1;
	for(int i=1;i<n;i++)
		for(int j=0;j<=i;j++)
			for(int s=0;s<=i*i/2;s++){
				if(j)Add(f[i+1][j-1][j+s],1ll*f[i][j][s]*j%Mod*j%Mod);
				Add(f[i+1][j][j+s],1ll*f[i][j][s]*(2*j+1)%Mod);
				Add(f[i+1][j+1][j+s],f[i][j][s]);
			}
	printf("%d\n",f[n][0][k/2]);
	return 0;
}