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

int main(){
  int a[10][331]={0};
  int p[10]={0,1,2,3,4,5,6,7,8,9};
  int q[10]={362880,40320,5040,720,120,24,6,2,1,1};
  int s,n;
  do{
    s=0;
    for(int i=0;i<10;++i){
      s+=(i+1)*p[i];
      a[i][s]++;
    }
  }while(next_permutation(p,p+10));
  while(cin>>n>>s){
    if(s>330) cout<<0;
    else cout<<a[n-1][s]/q[n-1];
    cout<<endl;
  }
  return 0;
}