// AOJ 0070
#include<iostream>
using namespace std;

int solve(int n, int s, long long int available) {
  if (s > (n + 1) * n / 2 * 9) return 0;
  
  if (n == 1) {
    return ((0 <= s && s < 10 && (available>>s)&1) ? 1 : 0);
  } else {
  int sum = 0;
    for (int i = 0, mxm = s / n; i <= mxm; i++) {
      if ((available >> i)&1) {
        int v = solve(n - 1, s - n * i, available&~(1<<i));
        sum += v;
      }
    }
    return sum;
  }
}

int main() {
  int n, s;
  while (cin >> n >> s) {
    cout << solve(n, s, (1<<10)-1) << endl;
  }
}