#include <iostream>
//#include <list>
#include <vector>
#include <algorithm>
#include <cstdio>


using namespace std;

int main()
{
	const int DIM = 10;
	
	
	vector<int> data;
	
	for (int i = 0; i < DIM; ++i) {
		data.push_back(i);
	}
	
	vector< vector<int> > prevVec(DIM, vector<int>(DIM, -1));
	vector< vector<int> > table(DIM, vector<int>(331, 0));
//	vector< vector< list< vector<int> > > > tableList(DIM, vector< list< vector<int> > >(331));
	
	do {
		int index = 0;
		
		for (int n = 0; n < DIM; ++n) {
			index += data.at(n) * (n + 1);
			
			if (data.at(n) != prevVec.at(n).at(n)) {
				prevVec.at(n).assign(data.begin(), data.end());
				++table.at(n).at(index);
//				tableList.at(n).at(index).push_back(data);
			}
		}
	} while (next_permutation(data.begin(), data.end()));
	
	int n, s;
	
//	while (cin >> n >> s) {
	while (scanf("%d%d", &n, &s) != EOF) {
		if (n == 0 || n > 10 || s > 330) {
			cout << "0" << endl;
		} else {
			cout << table.at(n - 1).at(s) << endl;
/*			list< vector<int> > data = tableList.at(n - 1).at(s);
			list< vector<int> >::iterator itr = data.begin();
			for (; itr != data.end(); ++itr) {
				for (int i = 0; i < n; ++i) {
					cout << (*itr).at(i) << ",";
				}
				cout << endl;
			}
*/		}
	}

	return 0;
}