#include <iostream>
using namespace std;

int n, s;
bool num[10] = { 0 };
int combinations(int c, int sum) {
	if (sum > s) return 0;
	if (c == n) {
		if (sum == s) return 1;
		return 0;
	}
	int res = 0;
	for (int i = 0; i < 10; i++) {
		if (num[i]) continue;
		num[i] = 1;
		res += combinations(c + 1, sum + i * (c + 1));
		num[i] = 0;
	}
	return res;
}

int main() {
	while (cin >> n) {
		cin >> s;
		if (n > 10 || s > 330) {
			cout << 0 << endl;
			continue;
		}
		cout << combinations(0, 0) << endl;
	}
	return 0;
}