#include <cstdio>
#include <algorithm>

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

int n, s, t;
bool used[10];

int dfs(int k){
	if(k == 0){
		return t == s;
	}
	int cnt = 0;
	rep(i, 10){
		if(!used[i]){
			t += i * k;
			used[i] = true;
			cnt += dfs(k - 1);
			t -= i * k;
			used[i] = false;
		}
	}
	return cnt;
}

int main(){
	while(scanf("%d%d", &n, &s) != EOF){
		printf("%d\n", dfs(n));
	}
	return 0;
}