#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int m[11][331],b[10],n,s;
void f(int s,int d){
  int i;
  if(d==n)
    m[n][s]++;
  else{
    for(i=0;i<10;i++){
      if(b[i]==-1){
	b[i]=1;
	f(s+(d+1)*i,d+1);
	b[i]=-1;
      }
    }
  }
  return;
}
int main(){
  memset(m,0,sizeof(m));
  memset(b,-1,sizeof(b));
  for(n=1;n<10+1;n++)
    f(0,0);
  while(cin>>n>>s){
    if(n>10||s>330)
      cout<<0<<endl;
    else
      cout<<m[n][s]<<endl;
  }
  return 0;
}