// 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, int& sum)
{
	if(r>=n){
		if(sum==s)
			cnt++;
		return;
	}

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

int main()
{
	int MAX = 2*1+3*2+4*3*5*4+6*5+7*6+8*7+9*8+10*9;

	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;
			continue;
		}

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

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

		cout << cnt << endl;
	}

	return 0;
}