#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int num[10];
long  fact[10],dp[10][331];//??????331??\?????????????????¨????????????dp[10][1000]??¨?????§???????????????

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

	do{
		int t = 0;
		for(int i = 0; i < 10; i++){
			t += num[i]*(i+1);
			dp[i][t]++;
		}
	}while(next_permutation(num,num+10));

	fact[0] = 1;
	for(int i = 1; i < 10; i++){
		fact[i] = fact[i-1]*i;
	}

	int n,s;
	while(cin>>n>>s){
		if(n > 10 || s > 330){
			cout<<0<<endl;
			continue;
		}
		if(n == 0){
			if(s == 0) cout<<1<<endl;
			else cout<<0<<endl;
			continue;
		}
		cout<<dp[n-1][s]/fact[10-n]<<endl;
	}
	return 0;
}