
#include<stdlib.h>
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<cstring>
#include<time.h>
#include<cmath>
#include<queue>
using namespace std;
#define INF 1000000
int s1[10]={0,1,2,3,4,5,6,7,8,9},t1[10];
int s;
int L,ans=0;
void check(){
	int sum=0;
	for(int i=0;i<L;i++){
		sum+=(i+1)*t1[i];
	}
	if(s==sum){
		ans++;
	}
}
void Permutation(int s[],int t[],int num){
	if(num==L){
		check();
		
	}else{
		for(int i=0;i<10-num;i++){
			t[num]=s[i];
			int a=s[i];
			s[i]=s[10-num-1];
			Permutation(s,t,num+1);
			s[10-num-1]=s[i];
			s[i]=a;

		}
	}
}
int main(){
	while(cin>>L>>s){
		ans=0;
		Permutation(s1,t1,0);
		cout<<ans<<endl;
	}
	return 0;
}	