#include <iostream>
#include <stack>
class Usable_Number {
	bool usable[10]{true, true, true, true, true, true, true, true, true, true};
	std::stack<int> history{};
public:
	bool is_usable(const int &n) const {
		return usable[n];
	}
	Usable_Number &use(const int &n) {
		usable[n] = false;
		history.push(n);
		return *this;
	}
	Usable_Number &revert() {
		if (history.size() != 0) {
			usable[history.top()] = true;
			history.pop();
		}
		return *this;
	}
};
int dfs(Usable_Number &usable, const int &n, const int &s) {
	if (n == 0 && s == 0) {
		usable.revert();
		return 1;
	}
	else {
		int sum = 0;
		for (auto i = 0; i < 10; ++i) {
			if (usable.is_usable(i) && s >= n * i) {
				sum += dfs(usable.use(i), n - 1, s - n * i);
			}
		}
		usable.revert();
		return sum;
	}
}
int main() {
	Usable_Number usable;
	for (int n, s; std::cin >> n >> s;) {
		std::cout << dfs(usable, n, s) << std::endl;
	}
}