#include <iostream>
#include <string>
#include <memory.h>

using namespace std;

int ans[11][331] = { 0 };


int solve(int n, int sum, int *pUsed) {
	int i, count = 0;

	if (sum < 0) {
		return 0;
	}
	if (ans[n][sum] != 0) {
		return ans[n][sum];
	}

	if (n == 1) {
		if (sum < 10 && pUsed[sum] == 0) {
			ans[n][sum] = count;
			return 1;
		}
		return 0;
	}

	for (i = 0; i < 10; i++) {
		if (!pUsed[i]) {
			pUsed[i] = 1;
			count += solve(n - 1, sum - n*i, pUsed);
			pUsed[i] = 0;
		}
	}

	return count;
}

int main(void) {
	int n, s, count;
	int used[10] = { 0 };

	while (cin >> n >> s) {
		count = 0;
		if (s < 331) {
			count = solve(n, s, used);
			memset(used, 0, 10);
		}
		cout << count << endl;
	}

	return 0;
}


