#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define it vector<int>::iterator
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
using namespace std;

bool next_combination ( it first1 ,
  it last1 ,
  it first2 ,
  it last2 ){
  if (( first1 == last1 ) || ( first2 == last2 )) {
    return false ;
  }
  it m1 = last1 ;
  it m2 = last2 ; --m2;
  while (--m1 != first1 && !(*m1 < *m2 )){
  }
  bool result = (m1 == first1 ) && !(*first1 < *m2 );
  if (! result ) {
    while ( first2 != m2 && !(*m1 < *first2 )) {
      ++ first2 ;
    }
    first1 = m1;
    std :: iter_swap (first1 , first2 );
    ++ first1 ;
    ++ first2 ;
  }
  if (( first1 != last1 ) && ( first2 != last2 )) {
    m1 = last1 ; m2 = first2 ;
    while (( m1 != first1 ) && (m2 != last2 )) {
      std :: iter_swap (--m1 , m2 );
      ++ m2;
    }
    std :: reverse (first1 , m1 );
    std :: reverse (first1 , last1 );
    std :: reverse (m2 , last2 );
    std :: reverse (first2 , last2 );
  }
  return ! result ;
}
bool next_combination(it first,it middle,it last){
  return next_combination (first , middle , middle , last );
}
int main(){
	int n,s;
	while(cin>>n>>s){
		int sum=0;
		rep(i,n)sum+=(i+1)*(n-i-1);
		if(sum>s){
			cout<<0<<endl;
			continue;
		}
		vi d(10);
		int co=0;
		rep(i,10)d[i]=i;
		do{
			do{
				int sum=0;
				rep(i,n)sum+=(i+1)*d[i];
				if(sum==s){
					co++;
				}
			}while(next_permutation(d.begin(),d.begin()+n));
		}while(next_combination(d.begin(),d.begin()+n,d.end()));
		cout<<co<<endl;
	}
}