#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

int data[10][500];


void make(int sum, int checked, int rev){
  data[rev][sum]++;
  for(int i = 0; i < 9; i++){
    if(!(checked & (1<<i))){
      make(sum+(rev+1)*i,checked+(1<<i),rev+1);
    }
  }
}
int main(){

  memset(data,0,sizeof(data));
  make(0,0,0);
  fill(data[0],data[0]+500,0);
  int n,s;
  while(cin >> n >> s) cout << data[n][s] << endl;
  return 0;
}