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