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

	int 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()
{
	int n, s;
	while (cin >> n >> s) {
		cout << func(0, 0, n, 0, s) << endl;
	}
	return 0;
}