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

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

int s, n;
int ans;
int dp[11][331];

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;
		}

		for(int i=0; i<11; i++){
			for(int j=0; j<331; j++){
				dp[i][j] = -1;
			}
		}

		if(s > 330){
			printf("0\n");
			continue;
		}else if(n == 10 && s >= 248){
			s = 165 + (330 - s);
		}else if(n == 9 && s >= 203){
			s = 120 + (285 - s);
		}else if(n == 8 && s >= 163){
			s = 84 + (240 - s);
		}

		if(dp[n][s] != -1){
			printf("%d\n", dp[n][s]);
			continue;
		}

		for(int i=0; i<10; i++){
			char temp[10];
			memcpy(temp, num, 10);
			temp[i] = 0;
			rec(temp, 2, i);
		}

		dp[n][s] = ans;
		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;
}