#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

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

void A(int x){
	if(sum > s) return;
	if(x == 0){
		if(sum == s) ans++;
		return;
	}
	rep(i,10){
		if(used[i]) continue;
		used[i] = true;
		sum += x*i;
		A(x-1);
		sum -= x*i;
		used[i] = false;
	}
}

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