#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<queue>
using namespace std;

bool used[10];
int sum;
int dp[11][10005];
void saiki(int c, int d) {//c?????§??§d
	dp[c][d]++;
	if (c == 10) {
		return;
	}
	for (int e = 0; e < 10; e++) {
		if (!used[e]) {
			used[e] = true;
			saiki(c + 1, d + (c + 1)*e);
			used[e] = false;
		}
	}
}
int main() {
	saiki(0, 0);
	int a, b;
	while (cin >> a >> b) {
		cout << dp[a][b] << endl;
	}
}