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


int table[10][10001];
int perm[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };


int factorial(int n){
	int ret = 1;
	for (int i = 1; i <= n; i++) ret *= i;
	return ret;
}


int main(){
	do {
		int sum = 0;
		for (int i = 1; i <= 10; i++){
			sum += i * perm[i - 1];
			table[i - 1][sum]++;
		}
	} while (next_permutation(perm, perm + 10));

	int n, s;
	while (cin >> n >> s){
		cout << table[n - 1][s] / factorial(10 - n) << endl;
	}

	return 0;
}