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

int dfs(int i, int sum);

int qq[10][10];
long int nmax[10] = {0};
int used[10] = {0};
int n, s;

int main() {
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			qq[i][j] = i*j;
		}
	}
	for (int i = 9; i > 0; i--) {
		for (int j = 0; j < 10; j++) {
			if (9 - i <= j)
				nmax[j] += i * ( j + i - 9 + 1);
		}
	}
	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;
}