#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int m[10][1024][350];
int search(int n, int s, int p){
  if(n > 10 || n < 1 || s < 0 || s >= 350) return 0;
  if(n == 1){
    if(s > 9) return 0;
    if((p & (1 << s)) == 0) return 1;
    else return 0;
  }
  if(m[n-1][p][s] >= 0) return m[n-1][p][s];
  int r = 0;
  for(int j = min(s/n,9); j >= 0; j--){
    if((p & (1 << j)) == 0) {
      r += search(n-1, s - n * j, (p | 1 << j));
    }
  }
  m[n-1][p][s] = r;
  return r;
}
int main()
{
  int n,s;
  memset(m,-1,sizeof(m));
  while(cin >> n >> s){
    cout << search(n,s,0) << endl;
  }
  return 0;
}