#include <iostream>

using namespace std;

int rec(int i,int n,int sum,int equal){
	static int flag[10] = {0};
	if(i == n){
		if(sum == equal){
			return 1;
		}else{
			return 0;
		}
	}
	int res = 0;
	for(int j = 0;j < 10;j++){
		if(!flag[j]){
			flag[j] = 1;
			res += rec(i + 1,n,sum + (i + 1) * j,equal);
			flag[j] = 0;
		}
	}
	return res;
}

int main(void){
	int n, s;
	while(!cin.eof()){
		cin >> n >> s;
		cout << rec(0,n,0,s) << endl;
	}
	return 0;
}