#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(b); i++)
#define rep(i,b) loop(i,0,b)

template<class iter>
bool next_combination(iter f1, iter l1, iter f2, iter l2){
    if((f1==l1)||(f2==l2)){
        return false;
    }
    iter m1 =l1;
    iter m2 =l2; --m2;
    while(--m1!=f1 &&!(*m1<*m2)){
    }
    bool result =(m1==f1)&&!(*f1<*m2);
    if(!result){
        while(f2!=m2 &&!(*m1<*f2)){
            ++f2;
        }
        f1 =m1;
        iter_swap(f1, f2);
        ++f1;
        ++f2;
    }
    if((f1!=l1)&&(f2!=l2)){
        m1 =l1; m2 =f2;
        while((m1!=f1)&&(m2!=l2)){
            iter_swap(--m1, m2);
            ++m2;
        }
        reverse(f1, m1);
        reverse(f1, l1);
        reverse(m2, l2);
        reverse(f2, l2);
    }
    return !result;
}

template<class iter >
bool next_combination(iter first, iter middle, iter last){
    return next_combination(first, middle, middle, last);
}

int ns[11][1000];
int arr[10];
int n,s;
int main(){
    memset(ns,0,sizeof(ns));
    rep(i,10) arr[i]=i;
    loop(i,1,11){
        do{
            //rep(k,i) cout<<arr[k]<<" ";
            //cout<<endl;
            do{
                int ts=0;
                rep(j,i)ts+=(j+1)*arr[j];
                ns[i][ts]++;
            }while(next_permutation(arr,arr+i));
        }while(next_combination(arr,arr+i,arr+10));
    }
    while(cin>>n>>s){
        if(1<=n && n<=10 && 0 <= s && s<= 1000)
            cout<<ns[n][s]<<endl;
        else cout<<0<<endl;
    }
}