#include <stdio.h>

int s_ans[512][10] = {0};
int table[10] = {0};
int k[10] = {0};
int k_num = 0;

void makeans(void) {
	int i;
	int s = 0;

	if(k_num) {
		for(i = 0; i < k_num; i++) {
			s += (i + 1) * k[i];
		}
		s_ans[s][k_num - 1]++;
	}

	for(i = 0; i < 10; i++) {
		if(!table[i]) {
			k[k_num] = i; k_num++;
			table[i] = 1;
			makeans();
			k_num--;
			table[i] = 0;
		}
	}
}

int main(void) {
	int n, s;
	
	makeans();
	while(scanf("%d %d", &n, &s) != EOF) {
		printf("%d\n", s_ans[s][n - 1]);
	}

	return 0;
}