#include <iostream>
class Memo {
	int flag;
	Memo(int n) :flag{ n } {}
public:
	Memo() :flag{ 0 } {}
	class Iterator {
		const int flag;
		int n;
	public:
		Iterator(int aflag, int an) :flag{ aflag }, n{ an } {}
		int operator*() const {
			return n;
		}
		Iterator operator++() {
			while (((1 << ++n) | flag) == flag && n < 10);
			return *this;
		}
		bool operator!=(const Iterator other) const {
			return n != other.n;
		}
	};
	Memo use(int u) {
		return Memo(flag | (1 << u));
	}
	Iterator begin() const {
		return ++Iterator(flag, -1);
	}
	Iterator end() const {
		return Iterator(flag, 10);
	}
};
int f(int n, int s, Memo memo = Memo()) {
	if (n == 0 && s == 0) return 1;
	if (s <= 0) return 0;
	if (n == 0) return 0;
	int sum = 0;
	for (const auto &unuse : memo) {
		sum += f(n - 1, s - unuse * n, memo.use(unuse));
	}
	return sum;
}
int main() {
	int n, s;
	while (std::cin >> n) {
		std::cin >> s;
		std::cout << f(n, s) << std::endl;
	}
}
