#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
typedef long long ll;
typedef long double ld;
const ll inf = 999999999999999999;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
ll gcm(ll i, ll j) {//?????§??¬?´???°
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}

//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, s;
bool b[10];
int solve(int i, int wa) {
	if (i == n) {
		if (wa == s)
			return 1;
		return 0;
	}
	int ans = 0;
	for (int j = 0; j < 10; j++) {
		if (b[j]) {
			b[j] = 0;
			ans += solve(i + 1, wa + (i + 1)*j);
			b[j] = 1;
		}
	}
	return ans;
}
signed main() {
	while (cin >> n >> s) {
		for (int i = 0; i < 10; i++)
			b[i] = 1;
		cout << solve(0, 0) << endl;
	}
	//getchar(); getchar();
}