#include <iostream>
#include <vector>

int memo_dp(std::vector<std::vector<int>> &memo, const int &n, const int &s, const int &used = 0, const int &current_n = 1) {
	if (s < 0 || s > 330) {
		return 0;
	}
	else if (n < current_n) {
		if (s == 0) {
			return 1;
		}
		else {
			return 0;
		}
	}
	else if (memo[used][s] >= 0) {
		return memo[used][s];
	}
	else {
		int res = 0;
		for (auto i = 0; i < 10; ++i) {
			if (((1 << i) & used) == 0) {
				res += memo_dp(memo, n, s - current_n * i, used + (1 << i), current_n + 1);
			}
		}
		memo[used][s] = res;
		return res;
	}
}
int main() {
	std::vector<std::vector<int>> memo(1025, std::vector<int>(331, -1));
	int n, s;
	while (std::cin >> n >> s) {
		std::cout << memo_dp(memo, n, s) << std::endl;
	}
	return 0;
}