#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define iss istringstream
#define sst stringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sh(i) (1LL<<i)
#define sz size()
#define vi vector<int>
#define vc vector
#define vl vector<ll>
#define vs vector<string>

int n,s;
typedef pair<pi,int> T;
map<T,int> M;

int f(int m,int s,int S){
	if(m==n+1)return !s;
	if(M.find(T(pi(m,s),S))!=M.end())return M[T(pi(m,s),S)];
	int& r=M[T(pi(m,s),S)];
	rep(i,10)if(!(S&1<<i)&&s>=m*i)r+=f(m+1,s-m*i,S|1<<i);
	return r;
}

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