#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
typedef queue<int> Q;
int n,s,ans;
void solve(int now,int sum,Q a){
	if(sum>s)
		return;
	int temp;
	if(now==n+1){
		if(sum==s)
			ans++;
		return ;
	}
	now++;
	for(int i=0;i<a.size();i++){
		temp=a.front();
		a.pop();
		solve(now,sum+temp*(now-1),a);
		a.push(temp);

	}
}
int main(){
	while(cin>>n>>s){
		Q a;
		ans=0;
		for(int i=0;i<10;i++)
			a.push(i);
		solve(1,0,a);
		//now sum
		cout<<ans<<endl;
	}
	return 0;
}