#include <cstdio>

bool used[10];
short int sum, ans, n, s, Min, Max;

inline void A(int x){
	if(sum > s) return;
	if(x == 0){
		if(sum == s) ans++;
		return;
	}
	short int tmp = -x;
	for(int i = 9; i >= 0; i--){
		tmp += x;
		if(used[i]) continue;
		used[i] = true;
		sum += tmp;
		A(x-1);
		sum -= tmp;
		used[i] = false;
	}
}

int main(){
	while(scanf("%d%d", &n, &s) != EOF){
		Min = 0;
		Max = n*(n+1)*(2*n+1)/6;
		for(int i = n-1; i >= 0; i--) Min += (n-i)*(i+1);
		if(s > Max || s < Min){
			printf("0\n");
			continue;
		}
		ans = 0; sum = 0;
		for(int i = 9; i >= 0; i--) used[i] = false;
		A(n);
		printf("%d\n", ans);
	}
}