#include <cstdio>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

int x;
bool u[10];
int t[11][1000];

void dfs(int k){
	if(k > 10){
		return;
	}
	rep(i, 10){
		if(!u[i]){
			x += i * k;
			u[i] = true;
			++t[k][x];
			dfs(k + 1);
			x -= i * k;
			u[i] = false;
		}
	}
}

int main(){
	dfs(1);

	int n, s;
	while(scanf("%d%d", &n, &s) != EOF){
		printf("%d\n", s < 1000 ? t[n][s]  : 0);
	}
	return 0;
}