#include <iostream>
using namespace std;
bool p[10];
int search(int i, int n, int s, int t){
  int d = t - s;
  if(i == n){
    if(d % i) return 0;
    int j = d / i;
    if(!p[j]) return 1;
    else return 0;
  }
  int r = 0;
  for(int j = 0; j < 10 && i * j <= d; j++){
    if(!p[j]) {
      p[j] = true;
      r += search(i+1, n, s + i*j, t);
      p[j] = false;
    }
  }
  return r;
}
int main()
{
  int n,s;
  while(cin >> n >> s){
    cout << search(1,n,0,s) << endl;
  }
  return 0;
}