#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int n,s;

int f(int mask,int re,int i){
//cout<<"  "<<mask<<" "<<re<<" "<<i<<endl;
	if(i>=n+1){
		if(re==0)return 1;
		else return 0;
	}
	if(re<0)return 0;
	int res=0;
	int k;
	for(k=0;k<10;k++){
		if(mask&1<<k)continue;
//cout<<k<<" "<<re<<" "<<i<<endl;
		res+=f(mask|1<<k,re-k*i,i+1);
	}
	return res;
}

int main() {
	while(cin>>n>>s){
		cout<<f(0,s,1)<<endl;
	}
	return 0;
}