#include<iostream>
using namespace std;
int n, s;
bool b[11] = {};
int f(int p, int sum) {
	if (p == n) {
		if (s == sum)return 1;
		else return 0;
	}
	int cnt = 0;
	for (int i = 0; i <= 9; i++) {
		if (b[i])continue;
		b[i] = true;
		cnt += f(p + 1, sum + (p + 1)*i);
		b[i] = false;
	}
	return cnt;
}
int main() {
	while (cin >> n >> s) {
		cout << f(0, 0) << endl;
	}
}