#include <iostream>
#include <vector>
#include <memory>
class Shared_array {
	std::shared_ptr<char> ptr;
	int _size;
public:
	Shared_array(int size) :ptr{ std::shared_ptr<char>(new char[size], std::default_delete<char[]>()) }, _size{ size } {}
	Shared_array(const Shared_array &other) :ptr{ other.ptr }, _size{ other._size } {}
	char operator[](const int index) const {
		return ptr.get()[index];
	}
	char &operator[](const int index) {
		return ptr.get()[index];
	}
	int size() const { return _size; }
};
int dfs(Shared_array sa, int n, int s, int now = 1, int sum = 0) {
	if (now > n && sum == s) return 1;
	if (now > n) return 0;
	if (sum > s) return 0;
	int res = 0;
	for (auto i = now - 1; i < 10; ++i) {
		auto temp = sa[i];
		sa[i] = sa[now - 1]; sa[now - 1] = temp;
		res += dfs(sa, n, s, now + 1, sum + now * temp);
		temp = sa[i];
		sa[i] = sa[now - 1]; sa[now - 1] = temp;
	}
	return res;
}
int f(int n, int s) {
	Shared_array arr(10);
	for (auto i = 0; i < 10; ++i) arr[i] = i;
	return dfs(arr, n, s);
}
int main() {
	int n, s;
	while (std::cin >> n >> s) {
		std::cout << f(n, s) << std::endl;
	}
}
