#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
#include <algorithm>

#define int64 long long int
#define NUM 10
using namespace std;

int ans(int, int);
bool next_combination(bool *, int);

int main()
{
	int n, s;
	while(cin >> n >> s){
		cout << ans(n, s) << endl;
	}
	return 0;
}

bool next_combination(bool *p, int N)	//N = 10
{
	int i, c;
	i = N-1, c = 0;
	while(p[i]) c++, p[i] = false, i--;
	while(!p[i]){
		if(i > 0) i--;
		else return false;
	}
	p[i] = false;
	c++, i++;
	for(int j=0; j<c; j++) p[i+j] = true;
	return true;
}

int ans(int n, int s)
{
	int min, max, ret = 0;
	bool p[NUM] = {0};

	min = max = 0;
	for(int i=1; i<=n; i++){
		min += i*(n-i);
		max += i*(NUM-1-n+i);
	}
	if(s < min || max < s) return 0;

	for(int i=0; i<n; i++) p[i] = true;

	do{
		vector<int> pairs;

		for(int i=0; i<NUM; i++)
			if(p[i]) pairs.push_back(i);

		do{
			int sum = 0;
			for(int i=0; i<pairs.size(); i++) sum += (i+1) * pairs[i];
			if(sum == s) ret++;
		}while(next_permutation(pairs.begin(), pairs.end()));
		
	}while(next_combination(p, NUM));

	return ret;
}