#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};
int L,ans=0,s;

void Permutation(int s2[],int t,int num){
	if(num==L){
		if(t==s)ans++;
	}else{
		if(t>s)return;
		for(int i=0;i<10-num;i++){
			int a=s2[i];
			s2[i]=s2[10-num-1];
			Permutation(s2,t+(num+1)*a,num+1);
			s2[10-num-1]=s2[i];
			s2[i]=a;
		}
	}
}
int main(){
	while(cin>>L>>s){
		ans=0;
		Permutation(s1,0,0);
		cout<<ans<<endl;
	}

	return 0;
}	