#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int dp[11][1000];
int main(){
	int n,s;
	int d[10];
	rep(i,1<<10){
		int c = 0;
		rep(j,10)if(i&(1<<j))d[c++] = j;	
		do{
			int r = 0;
			rep(j,c) r += (d[j])*(j+1);
			dp[c][r]++;
		}while(next_permutation(d,d+c));
	}
	while(cin >> n >> s){
		int ans = 0;
		if(s >= 0 && s < 1000 && n <= 10 && n > 0) ans = dp[n][s];
		cout << ans << endl;
	}
}