#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <cmath>
#include <type_traits>

template <class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v){
	os << "{ ";
	for( auto itr=v.begin(); itr!=v.end(); itr++ ){
		os << *itr << " ";
	}
	os << "}";
	return os;
}
int main(void){
	using namespace std;

	vector<pair<unsigned int, unsigned int>> input;
	map<unsigned int, map<unsigned int, unsigned int>> N;

	{
		unsigned int n,s;
		while(cin >> n >> s){
			input.push_back( make_pair(n,s) );
			N[n];
		}
	}

	for(auto itr=N.begin(); itr!=N.end(); itr++){
		unsigned int n = itr->first;

		vector<bool> permTable(10);
		fill(permTable.begin()+n, permTable.end(), true);
		do {
			vector<unsigned int> tmp;
			tmp.reserve(n);
			for (unsigned int i = 0; i < 10; ++i) {
				if (!permTable[i]) {
					tmp.push_back(i);
				}
			}
			do{
				unsigned int sum = 0;
				for(int i=0; i<n; i++){
					sum += (i+1)*tmp[i];
				}
				itr->second[sum]++;
			}while(std::next_permutation(tmp.begin(), tmp.end()));

		} while (std::next_permutation(permTable.begin(), permTable.end()));
	}

	for (auto itr=input.begin(); itr!=input.end(); itr++){
		cout << N[itr->first][itr->second] << endl;
	}
}