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

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

	int sum = 0;
	for(int i=0;i<10;i++){
		if(!used[i]){
			used[i] = true;
			sum += solve(n-1, s-i*n, used);
			used[i] = false;
		}
	}

	return sum;
}

int main(void){
	int n,s;

	while(cin>>n>>s){
		if(0<= s && s <= 330){
			bool used[10];
			fill(used,used+10,false);
			cout<<solve(n,s,used)<<endl;
		}
		else{
			cout<<0<<endl;
		}
	}

	return 0;
}