#include <iostream>
#include <cstring>

using namespace std;

int mem[1 << 10][3001];

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

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