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

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

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