#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int fct[14];

void init(){
  fct[0] = 1;
  REP(i,11)
    fct[i+1] = (i+1)*fct[i];
}

int main() {
  int n,s;
  init();
  vector<vector<int>> t(10,vector<int>(500));
  vector<int> ok(10);
  REP(i,10)ok[i]=i;
  int i = 0;
  do{
    int sum = 0;
    REP(j,10){
      sum += (j+1)*ok[j];
      ++t[j][sum];
    }
    ++i;
  } while(next_permutation(begin(ok),end(ok)));
  while(scanf("%d%d",&n,&s) != EOF) {
    if(n > 0 && s >= 0 && n <= 10 && s < 500)
      printf("%d\n", t[n-1][s]/fct[10-n]);
    else
      printf("0\n");
  }
  return 0;
}