#include <cstdio>
#include<iostream>
#include<cmath>

using namespace std;

int n,s;
int use[10]={0};

int kai(int i){
	if(i==0) return 1;
	else return i*kai(i-1);
}

inline int combination(register int d,register int sum){
	register int t=0;
	if(sum==s&&d-1==n) return 1;
	if(d-1>n||sum>s) return 0;
	for(int i=0;i<10;i++){
		if(sum+(i*d)>s) break;
		if(use[i]==0){
			use[i]=1;
			t+=combination(d+1,sum+(i*d));
			use[i]=0;
		}
	}
	return t;
}

int main(){
	std::ios_base::sync_with_stdio(false);

	while(cin>>n>>s){
		if(kai(n)>s) cout<<combination(1,0)<<endl;
		else cout<<0<<endl;
	}

	return 0;
}