// 2011/05/21 Tazoe

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

const int MAX = 1*0+2*1+3*2+4*3*5*4+6*5+7*6+8*7+9*8+10*9;

int cnt[10][MAX+1];

void prm(int k[10], int r, int& sum)
{
	if(r>=10)
		return;

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

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

	int sum = 0;
	prm(k, 0, sum);

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

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

		if(s>MAX)
			cout << 0 << endl;
		else
			cout << cnt[n-1][s] << endl;
	}

	return 0;
}