#include <iostream>
#include <bitset>

int main()
{
	const int N = 10;
	const int B = 1 << N;
	const int SMAX = 330;	// 10*9 + 9*8 + ... + 2*1 + 1*0 = 90+72+56+42+30+20+12+6+2+0 = 330
	int table[N + 1][SMAX + 1] = {0};
	
	int (*bitTable)[SMAX + 1] = new int[B][SMAX + 1];
	
	
	int emax[N + 1] = {0};
	for (int i = 1; i <= N; ++i) {
		emax[i] = emax[i - 1] + 9 * i - i * (i - 1) / 2;
	}
	
	bitTable[0][0] = 1;
	
	for (int i = 0; i < B; ++i) {
		std::bitset<N> bs(i);
		int nbc = bs.count() + 1;
		
		for (int j = 0; j < N; ++j) {
			if (bs.test(j) == false) {
				std::bitset<N> nextBit = bs;
				nextBit.set(j);
				
				int d = j * nbc;
				
				for (int k = 0; k <= emax[nbc]; ++k) {
					bitTable[nextBit.to_ulong()][k + d] += bitTable[i][k];
				}
			}
		}
	}
	
	for (int i = 0; i < B; ++i) {
		std::bitset<N> bs(i);
		int n = bs.count();
		for (int s = 0; s <= emax[n]; ++s) {
			table[n][s] += bitTable[bs.to_ulong()][s];
		}
	}
	
	delete [] bitTable;
	
	int n, s;
	while (std::cin >> n >> s) {
		if (n <= 0 || n > N || s > SMAX || s < 0) {
			std::cout << 0 << std::endl;
			continue;
		}
		std::cout << table[n][s] << std::endl;
	}
	
	
	return 0;
}