#include <iostream>
#include <vector>
void dfs(std::vector<int> &arr, std::vector<std::vector<int>> &memo, int n = 0, int s = 0) {
	if (n == 10) {
		return;
	}
++memo[n][s];
	for (auto i = n; i < 10; ++i) {
		auto temp = arr[i];
		arr[i] = arr[n]; arr[n] = temp;
		dfs(arr, memo, n + 1, s + temp * (n + 1));
		arr[n] = arr[i]; arr[i] = temp;
	}
}
int f(int n, int s) {
	static std::vector<std::vector<int>> memo(10, std::vector<int>(331, 0));
	static bool is_initialized = false;
	if (!is_initialized) {
		std::vector<int> arr(10);
		for (auto i = 0; i < 10; ++i) arr[i] = i;
		dfs(arr, memo);
		is_initialized = true;
	}
	if (0 <= s && s < 331 && memo[n][s] >= 0) return memo[n][s];
	return 0;
}
int main() {
	int n, s;
	while (std::cin >> n >> s) {
		std::cout << f(n, s) << std::endl;
	}
}
