#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int dp[11][331][1025];

int solve(int n,int s,int used){
	if(n == 0 && s == 0) return 1;
	if(n <= 0 || s < 0) return 0;
	if(dp[n][s][used] != -1) return dp[n][s][used];

	int sum = 0;
	for(int i=0;i<10;i++){
		if((used>>i) % 2 == 0){
			used += 1<<i;
			sum += solve(n-1, s-i*n, used);
			used -= 1<<i;
		}
	}

	return dp[n][s][used] = sum;
}

int main(void){
	int n,s;

	memset(dp,-1,sizeof(dp));

	while(cin>>n>>s){
		if(0 <= s && s <= 330){
			int used = 0;
			cout<<solve(n,s,used)<<endl;
		}
		else{
			cout<<0<<endl;
		}
	}

	return 0;
}