#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

int** table;

void recursive(int sum,bool checkTable[10],int count){
	if(count == 10)return;

	bool new_table[10-count][10];

	for(int i = 0; i < 10-count;i++){
		for(int k = 0; k < 10; k++)new_table[i][k] = checkTable[k];
	}

	int index = 0;
	for(int i = 0; i <= 9; i++){
		if(checkTable[i] == false){
			new_table[index][i] = true;
			table[count+1][sum+(count+1)*i]++;
			recursive(sum+(count+1)*i,new_table[index],count+1);
			index++;
		}
	}
}

int main(){

	table = new int*[11];
	for(int i = 1; i <= 10; i++){
		table[i] = new int[10001];
		for(int k = 0; k <= 10000; k++)table[i][k] = 0;
	}

	bool checkTable[10];
	for(int i = 0; i < 10; i++)checkTable[i] = false;

	recursive(0,checkTable,0);

	int n,s;

	while(scanf("%d %d",&n,&s) != EOF){
		printf("%d\n",table[n][s]);
	}

	return 0;
}