//C++11
//3.6sec (2.3sec @AOJ)
//2.6sec
#include<iostream>

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)

const int MAXN = 10;

int ncase;
bool used[MAXN];

void sum(int n,int m,int s,int t)
{
    if(m==n){
        if(s==t) ncase+=1;
        return;
    }
    if(t>s) return;
    REP(i,MAXN){
        if(!used[i]){
            used[i] = true;
            sum(n,m+1,s,t+i*(m+1));
            used[i] = false;
        }
    }
}

void solve(int n,int s)
{
    ncase=0;
    REP(i,MAXN) used[i]=false;
    sum(n,0,s,0);
    cout<<ncase<<endl;
}
int main(void)
{
    int n,s;
    while((cin>>n>>s)){
        solve(n,s);
    }
    return 0;
}