#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;
typedef vector <vi> vvi;
int K=1024,N=331,B[]={1,2,4,8,16,32,64,128,256,512},C[1024]={0};
vvi D(K,vi(N));
int init(){
	vi z(K);
	for (int i=0;i<N;i++)z[i]=0;
	for (int i=0;i<K;i++){
		D[i]=z;
		int tmp=i,tmp2=0,n=0;
		while (tmp){
			n+=tmp&1;
			tmp2++;
			tmp/=2;
		}
		C[i]=n;
		if(n==1)D[i][find(B,B+10,i)-B]=1;
		else{
			tmp = i;
			for (int j=0;j<tmp2;j++){
				if (tmp & 1){
					int dp = n*j,i2=i-B[j];
					for (int k=0;k<N-dp;k++)
						D[i][k+dp]+=D[i2][k];
				}
				tmp/=2;
			}
		}
	}
	return 0;
}
int main(){
	init();
	int n,s,i,x;
	while(1){
		cin>>n>>s;
		if(cin.eof())break;
		x=0;
		if(s<N)
			for(i=0;i<K;i++)
				if(C[i]==n)x+=D[i][s];
		cout<<x<<endl;
	}
}