#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <climits>
#include <sstream>
#include <bitset>
using namespace std;
 
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair
 
static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;
 
template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
    v.assign(a,vector<T>(b,t));
}
 
//v.erase(unique(v.begin(),v.end()),v.end());
vint v(10,0);
ll dp[10+5][331+10][(1<<10)+10]={-1};
ll foo(ll n,ll s,ll a){
	// cout<<n<<" "<<s<<" "<< static_cast<std::bitset<10> >(a)<<endl;
	if(s<0) return 0;
	if(dp[n][s][a]) return dp[n][s][a];
	if(n==0&&s==0) return dp[n][s][a]=1;
	if(n<=0) return dp[n][s][a]=0;
	ll ret=0;
	rep(i,10){
		// cout<<(a>>i)<<endl;
		if(a>>i&1){
			a-=1<<i;
			ret+=foo(n-1,s-n*i,a);
			a+=1<<i;
		}
	}
	return dp[n][s][a]=ret;
}


int main(){
	ll n,s;
	while(cin>>n){
		cin>>s;
		ll ans=foo(n,s,(1<<10)-1);
		cout<<ans<<endl;
	}
}