#include <iostream>
#include <cstdio>

using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
int dp[10+5][331+5][1<<10+5];

int calc(int n, int s, int a) {
	if(s > 330 || s < 0) return 0;
	if(dp[n][s][a] >= 0) return dp[n][s][a];
	if(n == 1) {
		if(s < 10 && a>>s&1) return	dp[n][s][a] = 1;
		else return dp[n][s][a] = 0;
	}
	int ret = 0;
	rep(i,10) {
		if(a>>i&1) ret += calc(n-1,s-n*i,a-(1<<i));
	}
	return dp[n][s][a] = ret;
}

int main() {
	rep(i,10) {
		rep(j,331) {
			rep(k,1<<10) {
				if(i == 0) dp[i][j][k] = 0;
				else dp[i][j][k] = -1;
			}
		}
	}
	int n, s;
	while(cin >> n){
		cin >> s;
		int ans;
		ans = calc(n,s,(1<<10)-1);
		cout << ans << endl;
	}
	return 0;
}