#include <stdio.h>
#include <string.h>

void rec(char* num, int k, int sum);

int s, n;
int ans;

int main(void){
	char num[10];

	while(scanf("%d %d", &n, &s) != EOF){
		ans = 0;
		for(int i=0; i<10; i++){
			num[i] = 1;
		}

		if(s > 330){
			printf("0\n");
			continue;
		}
		for(int i=0; i<10; i++){
			char temp[10];
			memcpy(temp, num, 10);
			temp[i] = 0;
			rec(temp, 2, i);
		}

		printf("%d\n", ans);
	}

	return 0;
}

void rec(char* num, int k, int sum){
	if(k == n+1){
		if(sum == s) {
			ans++;
		}
		return;
	}

	for(int i=0; i<10; i++){
		if(num[i] != 0){
			char temp[10];
			sum += (i*k);

			if(sum > s) continue;
			memcpy(temp, num, 10);
			temp[i] = 0;
			rec(temp, k+1, sum);
			sum -= (i*k);
		}
	}
	return;
}