#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

int n, s;

int rec(int i, int S, int sum)
{
	//printf("i = %d, S = %d, sum = %d\n", i, S, sum);	



	/*
	int decimal = S;
	int binary = 0;
	int base = 1;

	while (decimal > 0)
	{
		binary = binary + (decimal % 2) * base;
		decimal = decimal / 2;
		base = base * 10;
	}

	printf("S = %d\n", binary);
	*/



	if (i == n && sum == s)
	{
		//cout << "hit" << endl;
		return 1;
	}
	if (i > n - 1) return 0;

	int res = 0;
	for (int u=0; u<10; u++)
	{
		if (!(S >> u & 1))
		{
			int nsum = sum + (i + 1) * u;
			res += rec(i + 1, S | 1 << u, nsum);
		}
	}

	return res;
}

int main()
{
	while (cin >> n >> s)
	{
		cout << rec(0, 0, 0) << endl;
	}
	
	return 0;
}