include <iostream>
#include <string.h>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int flag[10];
int count;

void dfs(int i,int max,int a,int sum)
{
	if(a > sum || i > max+1 || sum > 330)
	{
		return;
	}
	else if(a == sum && i == max+1)
	{
		count++;
	}
	else
	{
		rep(k,10)
		{
			if(flag[k] == 0)
			{
				flag[k] = 1;
				int temp = i*k;
				dfs(i+1,max,a+i*k,sum);
				flag[k] = 0;
			}
		}
	}
}


int main()
{
	int n,s;
	while(cin >> n >> s)
	{
		memset(flag,0,sizeof(flag));		
		count = 0;
		dfs(1,n,0,s);
		cout << count << endl;
	}
	return 0;
}