#include <stdio.h>
#include <string.h>

#pragma warning(disable : 4996)

int n, s, dp[10][331][1024];

int rec(int depth, int ans, int bit)
{
	if (depth == n) return s == ans ? 1 : 0;

	if (dp[depth][ans][bit] != -1)
	{
		return dp[depth][ans][bit];
	}

	int res = 0;

	for (int i = 0; i < 10; i++)
	{
		if (!(bit & (1 << i)))
		{
			res += rec(depth + 1, ans + (depth + 1) * i, bit + (1 << i));
		}
	}

	dp[depth][ans][bit] = res;

	return res;
}

int main()
{
	while (~scanf("%d %d", &n, &s))
	{
		memset(dp, -1, sizeof(dp));

		printf("%d\n", rec(0, 0, 0));
	}

	return 0;
}