#include <iostream>
#include <cstring>
using namespace std;
#define REP(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) REP(i, 0, n)
int memo[11][1024][300];
int func(int k, int used_n, int n, int s, int goal)
{
	if (k == n) return s == goal;

	int& res = memo[k][used_n][s];
	if (res >= 0) return res;
	res = 0;
	rep(j, 10) if (!(used_n & (1<<j))) {
		res += func(k+1, used_n+(1<<j), n, s+(k+1)*j, goal);
	}
	return res;
}
int main()
{
	ios_base::sync_with_stdio(0);
	int n, s;
	while (cin >> n >> s) {
		memset(memo, -1, sizeof(memo));
		int res = n > 10 ? 0 : func(0, 0, n, 0, s);
		cout << res << endl;
	}
	return 0;
}