#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int n,s;
int cnt=0;

int vvv[10];
int size;

void dfs(int idx){
	if(size+10-idx<n)
		return;
	else if(size==n){
		// ツ計ツ算ツつキツづゥ
		do{
			int sum=0;
			for(int i = 0; i < n; i++)
				sum+=(i+1)*vvv[i];
			if(s==sum)
				cnt++;
		}while(next_permutation(vvv,vvv+n));
		return;
	}

	for(int i = idx; i < 10; i++){
		//vv.push_back(i);
		vvv[size]=i;
		size++;
		if(size+9-i<n){
			size--;
			return;
		}
		dfs(i+1);
		size--;
	}
}

int main(){

	while(cin>>n>>s){
		size=0;
		cnt=0;
//		vector<int> v;
		dfs(0);
		cout<<cnt<<endl;
	}

	return 0;
}