#include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

int n,s;

int rec(int index,int sum,int mask){
	if(index==n){
		if(sum==s)
			return 1;
		else
			return 0;
	}
	int res=0;
	rep(i,10){
		if(mask&(1<<i)) continue;
		int nmask=mask|(1<<i);
		int nsum=sum+(index+1)*i;
		res+=rec(index+1,nsum,nmask);
	}
	return res;
}

int main(void){
	while(cin >> n >> s){
		if(cin.eof())
			break;
		cout << rec(0,0,0) << endl;
	}
	return 0;
}