#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>

using namespace std;

long long int dp[10][331];
void q70() {

	int num[] = { 0,1,2,3,4,5,6,7,8,9 };
	int fact[10];

	do {
		int t = 0;
		for (int i = 0; i < 10; i++) {
			t += (i + 1)*num[i];
			dp[i][t]++;
		}
	} while (next_permutation(num, num + 10));

	fact[0] = 1;
	for (int i = 1; i <= 10; i++) {
		fact[i] = fact[i - 1] * i;
	}

	int n, s;
	for (; cin >> n >> s;) {
		if (s == 0) {
			cout << "1" << endl;
		}
		if (s > 331) {
			cout << "0" << endl;
		}
		else {
			cout << dp[n - 1][s] / fact[10 - n] << endl;
		}
	}
}

int main() {
	q70();
	return 0;
}