#include <iostream>
#include <algorithm>
using namespace std;
const int N_MAX = 10;
int n, s;
int selected[N_MAX];
int cnt;
bool used[10];

void combination(int p) {
	if (p == 0) {
		int sum = 0;
		for (int i = 0; i < n; i++) {
			sum += (i + 1) * selected[i];
		}
		if (sum == s) cnt++;
	}
	else {
		for (int i = 0; i < 10; i++) {
			if (used[i]) continue;
			selected[p - 1] = i;
			used[i] = true;
			combination(p - 1);
			used[i] = false;
		}
	}
}

int main () {
	while (cin >> n >> s) {
		fill(used, used + 10, false);
		cnt = 0;
		combination(n);
		cout << cnt << endl;
	}
	return 0;
}