#include <iostream>
#include <cmath>
using namespace std;

int dfs(int i, int sum);

int qq[10][11];	//[i][j] i*j
int nmax[11][11] = {0};
int used[10] = {0};
int n, s;

int main() {
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 11; j++) {
			qq[i][j] = i*j;
		}
	}
	for (int i = 0; i < 11; i++) {
		for (int j = i-1; j >= 0; j--) {
			nmax[i][j] += nmax[i][j+1] + (9-(i-1-j))*(i-(i-1-j));
		}
	}

	while ((cin >> n >> s) != NULL) {
		cout << dfs(0, 0) << endl;
		for (int i = 0; i < 10; i++)
			used[i] = 0;
	}
	return 0;
}

int dfs(int d, int sum) {
	int count = 0;
	
	if (d == n) {
		if (sum == s)
			return 1;
		else
			return 0;
	}
	if (sum > s)
		return 0;
	if (sum + nmax[n][d] < s) {
		return 0;
	};

	for (int i = 0; i < 10; i++) {
		if (!used[i]) {
			used[i] = d + 1;
			count += dfs(d + 1, sum + qq[i][used[i]]);
			used[i] = 0;
		}
	}

	return count;
}