#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int n, s, ans;

void rec(int depth, int sum, int used) {
	if (sum > s)
		return;
	if (depth == n) {
		if (s == sum)
			ans++;
		return;
	}
	depth++;
	for (int i = 0; i < 10; i++)
		if ((used & (0x01 << i)) == 0)
			rec(depth, sum + depth * i, used | (0x01 << i));
}

int main() {
	while (cin >> n >> s) {
		ans = 0;
		for (int i = 0; i < 10; i++)
			rec(1, i, (0x01 << i));
		cout << ans << endl;
	}
	return 0;
}