#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
using namespace std;
int n, s;
int sum = 0;
bool b[20];
int f(int k) {
	if (sum + 9 * k * (k + 1) / 2 < s)return 0;
	int r = 0;
	if (k == 0) return s == sum;
	for0(i, 10) {
		if (sum + i * k > s)break;
		if (b[i])continue;
		b[i] = 1; sum += k * i;
		r += f(k - 1);
		b[i] = 0; sum -= k * i;
	}
	return r;
}
signed main() {
	while (cin >> n >> s) printf("%d\n", f(n));
}
