#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int n[11][331];
int f[10],g;

void num(int d,int s) {
 int i;
 if (d==10) return;
 for (i=0;i<10;i++) {
	 if (f[i]==0) {
		 n[d][s+(d+1)*i]++;
	     f[i]=1;
	     num(d+1,s+(d+1)*i);
	     f[i]=0;
	 }
 }
}

int main() {
 int a,b; 
 num(0,0);
 while(cin >> a >> b) if (b>330) cout << 0 << endl; else cout << n[a-1][b] << endl; 
 return 0;
}