#include<iostream>
using namespace std;

int count[11][512];

void dfs(int d,int s,int used){
	count[d][s]++;
	if(d==10)return;
	for(int i=0;i<10;i++){
		if(used>>i&1)continue;
		dfs(d+1,s+i*(d+1),used|1<<i);
	}
}
int main(){
	dfs(0,0,0);
	int n,s;
	while(cin>>n)cin>>s,cout<<count[n][s]<<endl;
	return 0;
}