#include <iostream>
#include <algorithm>

using namespace std;

int a[11][11], n, s;

int func(int k, int t, bool used[10])
{
  if(k == n && t == s){
    return 1;
  }
  if(k == n){
    return 0;
  }

  int r = 0;
  for(int i = 0; i < 10; i++){
    if(used[i] && t+a[k][i] <= s){
      used[i] = false;
      r += func(k+1, t+a[k][i], used);
      used[i] = true;
    }
  }

  return r;
}

int main()
{
  bool used[10];

  for(int i = 0 ; i < 10; i++){
    for(int j = 0; j < 10; j++){
      a[i][j] = (i+1)*j;
    }
  }

  while(cin>>n>>s){
    fill(used, used+10, true);
    cout << func(0, 0, used) << endl;
  }

  return 0;
}