#include <bits/stdc++.h>
using namespace std;

const int INF = 1e+9;

int memo[11][1 << 10 + 1];
int n, s;

int dfs(int a, int sum, int c){
	if(memo[a][c] != -1)
		return memo[a][c];
	if(n == a){
		return sum == s;
	}
	if(sum > s)
		return 0;
	
	int res = 0;
	for(int i = 0; i < 10; ++i){
		if(!(c >> i & 1)){
			res += dfs(a + 1, sum + (a + 1) * i, c | 1 << i);
		}
	}
	return res;
}

int main() {
	memset(memo, -1, sizeof(memo));
	while(cin >> n >> s){
		cout << dfs(0, 0, 0) << endl;
	}
	return 0;
}