#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

#define fi first
#define se second

typedef long long ll;
typedef pair<int,int> pii;
ll dp[1 << 10][1000];
ll ans[11][1000];

int main() {
	vector<pii> v;
	for(int i = 0; i < (1 << 10); i++) {
		int tmp = i;
		pii a = pii(0,i);
		while(tmp) {
			tmp -= tmp & (-tmp);
			a.fi++;
		}
		v.push_back(a);
	}
	sort(v.begin(), v.end());
	dp[0][0] = 1;
	for(int i = 0; i < v.size(); i++) {
		for(int j = 0; j < 1000; j++) {
			for(int k = 0; k < 10; k++) {
				if(!(v[i].se & (1 << k)) && j+k*(v[i].fi+1) < 1000) {
					dp[v[i].se | (1 << k)][j+k*(v[i].fi+1)] += dp[v[i].se][j];
				}
			}
		}
	}
	for(int i = 0; i < v.size(); i++) {
		for(int j = 0; j < 1000; j++) {
			ans[v[i].fi][j] += dp[v[i].se][j];
		}
	}
	int n, s;
	while(cin >> n >> s) {
		cout << ans[n][s] << endl;
	}
}