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

int ans[12][1024];

void dfs(int bit,int d,int s){
	ans[d][s]++;
	for(int i=0;i<10;i++){
		if(bit&(1<<i))
			dfs(bit-(1<<i),d+1,s+(i*(d+1)));
	}
}

int main(){
	int n,s;
	dfs((1<<10)-1,0,0);
	while(cin>>n>>s)cout<<(s>1023?0:ans[n][s])<<endl;
}