#include <iostream>

using namespace std;

int n, s, count;
bool used[10];

void search( int sum, int depth )
{
	if(depth > n) {
		if(sum == s) ++count;
		return;
	}
	for(int i=0; i < 10; ++i) {
		if(used[i]) continue;
		if((i*depth)+sum > s) continue;
		used[i] = true;
		search(((i*depth)+sum), depth+1);
		used[i] = false;
	}
}

int main( void )
{
	while(cin >> n >> s) {
		for(int i=0; i < 10; ++i) used[i] = false;
		count = 0;
		if(n < 11 && s < 331) search(0, 1);
		cout << count << endl;
	}
	return 0;
}