#include <iostream>
#include <cstring>
using namespace std;

int table[11][10000];

void num(int size, int deep, int data[], int sum){
	if (size + 1 == deep){
		table[size][sum]++;
	}
	else {
		for (int i = 0; i <= 9; i++){
			if (data[i] == 0){
				data[i] = 1;
				num(size, deep + 1, data, sum+i*deep);
				data[i] = 0;
			}
		}
	}
	return;
}

int main(void)
{
	int n, s, data[10];
	for (int i = 1; i <= 10; i++){
		memset(data, 0, sizeof(data));
		num(i, 1, data, 0);
	}
	while (cin >> n >> s){
		cout << table[n][s] << endl;
	}
	
	return 0;
}