#include <cstdio>
using namespace std;

bool use[10];

int search(int n, int s)
{
	int num = 0;
	if (n == 0){
		return (!s);
	}
	
	for (int i = 0; i <= 9; i++){
		if (use[i] == false){
			use[i] = true;
			num += search(n - 1, s - i * n);
			use[i] = false;
		}
	}
	
	return (num);
}

int main()
{
	int n, s;
	
	while (scanf("%d %d", &n, &s) != EOF){
		for (int i = 0; i <= 9; i++){
			use[i] = false;
		}
		
		printf("%d\n", search(n, s));
	}
	
	return 0;
}