#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int n, s;
int a[20]; bool b[20];
int f(int p) {
	if (p > n) {
		int r = 0;
		for (int i = 1; i <= n; i++)r += a[i] * i;
		return r == s;
	}
	int r = 0;
	for (int i = 0; i < 10; i++) {
		if (!b[i]) {
			a[p] = i; b[i] = 1;
			r += f(p + 1);
			a[p] = -1; b[i] = 0;
		}
	}
	return r;
}
signed main() {
	while (cin >> n >> s)cout << f(1) << endl;
}
