#include<stdio.h>
#include<algorithm>
int main()
{
	int m[10][331]={0};
	int n,s,i,a[10],f[11]={1};
	for(i=0;i<10;++i)a[i]=i;
	for(i=1;i<10;++i)f[i]=f[i-1]*i;
	do
	{
		for(s=i=0;i<10;++i)
		{
			s+=(i+1)*a[i];
			++m[i][s];
		}
	}while(std::next_permutation(a,a+10));
	while(scanf("%d%d",&n,&s)>0)
		if(s>330)puts("0");
		else printf("%d\n",m[n-1][s]/f[10-n]);
	return 0;
}