#include<iostream>
#define MAX 10

using namespace std;

void permit(int *flag, int *p, int rest, int *nums, int n, int s, int *ans){
	int t = 0;
	for(int i = 0; i < n; i++ ){
		if( flag[i] ){
			t++;
		}
	}
	if( t == n ){
		// TODO
		int tmp = 0;
		for(int i = 1; i <= n; i++){
			tmp += i * nums[p[i - 1]];
		}
		if( tmp == s ) (*ans)++;
	}

	for(int i = 0; i < n; i++ ){
		if( flag[i] ){
			continue;
		}else{
			flag[i] = 1;
			p[n - rest] = i;
			permit(flag, p, rest - 1, nums, n, s, ans);
			flag[i] = 0;
		}
	}
}
void comb(int n, int k, int nnum, int s, int *ans){
	int *p;
	bool loop = false;

	p = new int[k];
	for(int i = 0; i < k; i++){
		p[i] = i;
	}

	do{
		int flag[MAX] = {0,}, pp[MAX] = {0,};
		loop = false;

		// TODO
		permit(flag, pp, nnum, p, nnum, s, ans);

		for(int pk = k - 1; pk >= 0; pk--){
			p[pk]++;
			if( p[pk] <= n - (k - pk) ){
				for(int j = pk + 1; j < k; j++){
					p[j] = p[j - 1] + 1;
				}
				pk++;
				loop = true;
				break;
			}
		}
	}while(loop);

	delete [] p;
}


int main(void){
	while( 1 ){
		int ans = 0;
		int n, s;

		cin >> n >> s;
		if( cin.eof() ) break;

		comb(10, n, n, s, &ans);

		cout << ans << endl;
	}
	return 0;
}