#include <cstdio>

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

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

int main(){
	for(int i = 0; i < 10; i++) A(i,i+1);
	while(scanf("%hd%hd", &n, &s) != EOF){
		if(s >= 10000 || s < 0){
			printf("0\n");
		} else{
			printf("%d\n", num[n-1][s]);
		}
	}
}