#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int res[10][1000];

int main() {
	vector<int> v;
	for(int i = 0; i < 10; i++) {
		v.push_back(i);
	}

	sort(v.begin(), v.end());
	int mx = 0;
	do {
		int tmp = 0;
		for(int j = 0; j < 10; j++) {
			tmp += v[j] * (1+j);
			res[j][tmp]++;
		}
	} while(next_permutation(v.begin(), v.end()));

	int fact = 1;
	for(int i = 0; i < 10; i++) {
		for(int j = 0; j < 1000; j++) {
			res[9-i][j] /= fact;
		}
		fact *= (i+1);
	}

	int n, s;
	while(cin >> n >> s) {
		if(n ==0 || n > 10 || s >= 1000)
			cout << 0 << endl;
		else
			cout << res[n-1][s] << endl;
	}
}