
#include <iostream>

using namespace std;

typedef struct { int val[10]; } numType;

int func(int n, int s, numType set) {
	int sum = 0;
	int new_n;
	if (n <= 0) return 0;
	if (n == 1) {
		if (s >= 9) return 0;
		return (set.val[s] != 1) ? 0 : 1;
	}
	for (int k = 9; k >= 0; k--) {
		if (set.val[k] == 0) continue;
		new_n = s - (n * k);
		if (new_n < 0) continue;
		set.val[k] = 0;
		sum += func(n - 1, new_n, set);
		set.val[k] = 1;
	}
	return sum;
}

int main(int argc, char* argv[])
{
	int n, s;
	numType set;

	memset(&set, 0, sizeof(set));

	while (1) {
		cin >> n >> s;
		for (int i = 0; i < 10 ; i++) set.val[i] = 1;
		cout << func(n, s, set) << endl;
	}
	return 0;
}