#include<iostream>
#include<bitset>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int dp[15][300][1030];

int f(int n,int s,int used){
	if(s<0)return 0;
	if(n==1){
		if(s>=0 &&s<10 && (1<<(9-s) & used))return 1;
		else return 0;
	}
	if(dp[n][s][used]!=-1)return dp[n][s][used];
	int res=0,temp=used;
	rep(i,10){
		used=temp;
		if(1<<(9-i) &used){
			used ^=(1<<(9-i));
			res+=f(n-1,s-n*i,used);
		}
	}
	return dp[n][s][temp]=res;
}

int main(){
	int n,s;
	while(cin>>n>>s){
		rep(i,15)rep(j,300)fill(dp[i][j],dp[i][j]+1024,-1);
		if(n>10){
			cout<<0<<endl;
			return 0;
		}
		cout<<f(n,s,1023)<<endl;
	}
	return 0;
}