#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
main(){
	int r,f,i,j,s,N,S;
	for(;~scanf("%d%d",&N,&S);){
		f=1;
		for(i=1;i<=10-N;i++)f*=i;
		vector<int>v;
		for(i=0;i<10;i++)v.push_back(i);
		for(r=i=0;i<3628800;i++){
			if(i%f==0){
				for(s=j=0;j<N;j++)s+=(j+1)*v[j];
				if(s==S)r++;
			}
			next_permutation(v.begin(),v.end());
		}
		printf("%d\n",r);
	}
}