#include <iostream>
using namespace std;

int che[10]={1};
int res[11][331];

void dfs(int bit,int sum,int num){
	res[num][sum]++;
	if(num<10){
		for(int i=0,B,S;i<10;i++){
			B=bit;
			S=sum;
			if(!(B&che[i])){
				S+=(num+1)*i;
				B=B|che[i];
				dfs(B,S,num+1);
			}
		}
	}
	
}

int main(){
	for(int i=1;i<10;i++)che[i]=che[i-1]*2;
	dfs(0,0,0);
	for(int n,s;cin>>n>>s;){
		if(s>330)cout<<0<<endl;
		else cout<<res[n][s]<<endl;
	}
	
	return 0;
}
