#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;
int f0070(vi A,int n,int s){
	int b1=0,b2=0,c=0,j=1,i,tmp,a=A.size();
	vi::iterator it1=A.begin(),it2=it1+a;
	if(n==1)return(find(it1,it2,s)==it2)?0:1;
	sort(it1,it2);
	it1+=n-1;
	it2-=n;
	for(i=0;i<n;i++){
		b1+=j*(*it1--);
		b2+=j*(*it2++);
		j++;
	}
	if(b1<=s&&s<=b2)
		for(i=0;i<a;i++){
			tmp=s-A[i]*n;
			if(tmp<0)break;
			vi A3(A);
			A3.erase(A3.begin()+i);
			c+=f0070(A3,n-1,tmp);
	}
	return c;
}
int main(){
	int n,s,i;
	vi A(10);
	for(i=0;i<10;A[i]=i++);
	while(1){
		cin>>n>>s;
		if(cin.eof())break;
		cout<<f0070(A,n,s)<<endl;
	}
}