#include <iostream>
#include <vector>
class Memo {
	int _flag;
	Memo(int f) :_flag{ f } {}
public:
	Memo() :_flag{ 0 } {}
	Memo use(int unuse) const {
		return Memo(_flag | (1 << unuse));
	}
	bool is_used(int n) const {
		return (_flag & (1 << n)) != 0;
	}
	int to_int() const { return _flag; }
};
int f(int n, int s, const Memo memo = Memo()) {
	static auto cache = std::vector<std::vector<int>>(1024, std::vector<int>(331, -1));
	if (n == 0 && s == 0) return 1;
	if (n <= 0 || s <= 0) return 0;
	if (s > 330) return 0;
	if (cache[memo.to_int()][s] >= 0) return cache[memo.to_int()][s];
	cache[memo.to_int()][s] = 0;
	for (auto i = 0; i < 10; ++i) {
		if (!memo.is_used(i)) cache[memo.to_int()][s]  += f(n - 1, s - i * n, memo.use(i));
	}
	return cache[memo.to_int()][s];
}
int main() {
	int n, s;
	while (std::cin >> n >> s) {
		std::cout << f(n, s) << std::endl;
	}
}
