#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int kai(int x){
int tmp=x;
loop(i,1,x-1)tmp*=x-i;
return tmp;
}
int main(){
int in[10];
rep(i,10)in[i]=i;
int n,s;
while(cin>>n>>s){
//rep(i,10)in[i]=i;
int co=0;
do{
int sum=0;
rep(i,n)sum+=in[i]*(i+1);
if(sum==s)co++;
}while(next_permutation(in,in+10));
cout<<co/kai(10-n)<<endl;
}
}