// 2011/05/21 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

void prm(int k[10], int r, int n, int s, int& cnt)
{
	if(r>=n){
		int sum = 0;
		for(int i=0; i<n; i++)
			sum += (i+1)*k[i];
		if(sum==s)
			cnt++;
		return;
	}

	for(int i=r; i<10; i++){
		int tmp = k[r];
		k[r] = k[i];
		k[i] = tmp;
		prm(k, r+1, n, s, cnt);
		k[i] = k[r];
		k[r] = tmp;
	}
}

int main()
{
	while(!cin.eof()){
		string str;
		getline(cin, str);
		if(str.empty())
			continue;

		istringstream ist(str);
		int n, s;
		ist >> n >> s;

		int k[10];
		for(int i=0; i<10; i++)
			k[i] = i;

		int cnt = 0;
		prm(k, 0, n, s, cnt);

		cout << cnt << endl;
	}

	return 0;
}