#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int n,s,ss;
  while(cin>>n>>s){
  int p[10];
  for(int i=0;i<10;i++)p[i]=i;
  int count = 0;
  do{
    sort(p+n,p+10);
    reverse(p+n,p+10);
    ss = 0;
    for(int i=0;i<n;i++)
      ss+=p[i]*(i+1);
    if(ss==s)count++;
  }while(next_permutation(p,p+10));
  cout<<count<<endl;
  }
  return 0;
}