#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstdlib>
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
int n,s;

int calc(vi v,int val)
{
	if(val>s)return 0;
	for(int i=0;i<=9;i++)
	{
		if(count(all(v),i)>=2)return 0;
	}
	if(v.size()==n)
	{
		return val==s;
	}
	int ans=0;
	for(int i=0;i<=9;i++)
	{
		v.push_back(i);
		ans+=calc(v,val+v.size()*i);
		v.pop_back();
	}
	return ans;
	
	
}

int main()
{
	
	while(cin>>n>>s)
	{
		vi a;
		cout<<calc(a,0)<<endl;
	}
	
}