#include<iostream>
#include<cstdlib>
using namespace std;
int dp[11][1<<10][331];
int dpset(int n, int data, int sum);
int main(){
	int n,m;
	memset(dp,-1,sizeof(dp));
	while(cin>>n>>m){
		if(m>330){cout<<"0"<<endl;}
		else{cout<<dpset(n,0,m)<<endl;}
	}
	return 0;
}
int dpset(int n, int data, int sum){
	int ans = 0;
	if(dp[n][data][sum]>=0){return dp[n][data][sum];}
	if(sum<0){return 0;}
	if(n == 1){
		if(!(data&(1<<sum))){ans = 1;}
	}
	else{
		for(int i=0; i<10; i++){
			if(!(data&(1<<i))){
				ans+=dpset(n-1,data|(1<<i),sum-i*n);
			}
		}
	}
	dp[n][data][sum] = ans;
	return ans;
}