#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;
int f0070(vi A,int n,int s){
	if (s<0)return 0;
	int b1=0,b2=0,c=0,j=1,i,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++;
	}
	vi A3(a-1);
	if (b1<=s&&s<=b2)
		for (i=0;i<a;i++){
			A3.clear();
			for (j=0;j<a;j++)
				if (j!=i)A3.push_back(A[j]);
			c+=f0070(A3,n-1,s-A[i]*n);
		}
	return c;
}
int main(){
	int n,s,i;
	vi A(10);
	for(i=0;i<10;i++)A[i]=i;
	while(1){
		cin>>n>>s;
		if (cin.eof())break;
		cout<<f0070(A,n,s)<<endl;
	}
}