#include <iostream>

using namespace std;

int countSol(int n, int s, bool a[], int depth)
{
	int count = 0;
	for (int i=0; i<10; i++) {
		if (a[i]) continue;
		if (n == depth) {
			if (depth*i == s) count++;
		}
		else {
			a[i] = true;
			count += countSol(n, s - depth*i, a, depth+1);
			a[i] = false;
		}
	}
	return count;
}

int main()
{
	int n, s;
	
	while (cin >> n >> s) {	
		bool appeared[10] = {false};
		cout << countSol(n, s, appeared, 1) << endl;
	}
	
	return 0;
}