#include<iostream>
#include<algorithm>
using namespace std;
int n,s,dp[11][10*9*9][1<<10];
int solve(int now,int sum,int a){
	int ans=0;
	if(dp[now][sum][a]!=-1)
		return dp[now][sum][a];
	if(sum>s)
		return dp[now][sum][a]=0; 
	if(now==n+1){
		if(sum==s)
		return dp[now][sum][a]=1;
	}
	now++;
	for(int i=0;i<10;i++){
		if(!((a>>i)&1))
		ans+=solve(now,sum+i*(now-1),a|(1<<i));
	}
	return dp[now-1][sum][a]=ans;
}
int main(){
	while(cin>>n>>s){
		int a[10];
		for(int i=0;i<=n+1;i++)
			for(int j=0;j<=n*9*9;j++)
				for(int k=0;k<1<<10;k++)
				dp[i][j][k]=-1;
		//now sum
		cout<<solve(1,0,0)<<endl;
	}
	return 0;
}