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

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

	int n, s;
	while(cin >> n >> s) {
		int res = 0;
		sort(v.begin(), v.end());
		do {
			long long tmp = 0;
			for(int i = 0; i < n; i++) {
				tmp += v[i] * (i+1);
			}
			if(tmp == s)
				res++;
		} while(next_permutation(v.begin(), v.end()));

		int div = 1;
		for(int i = 0; i < 10-n; i++) {
			div *= (i+1);
		}

		cout << res / div << endl;
	}
}