#include <iostream>
using namespace std;

bool used[10];

int dfs(int x, int n, int s) {
  int r = 0;
  if (!used[x]) {
    if (s < n*x) return 0;
    else if (s == n*x && n == 1) return 1;
    else if (n > 1) {
      used[x] = true;
      r = dfs(0, n-1, s-n*x);
      used[x] = false;
    }
  }
  if (x<9) {
    r += dfs(x+1, n, s);
  }
  return r;
}

int main() {
  int n, s;

  while (cin >> n >> s) {
    for (int i=0; i<n; i++) used[i] = false;
    cout << dfs(0, n, s) << endl;
  }

  return 0;
}