#include <cstdio>
#include <algorithm>
using namespace std;

int num[11];
int fact[11];

int main() {
  for (int i=0; i<10; i++) {
    num[i] = i;
  }

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

  while (1) {
    int n, s;
    if (scanf("%d%d", &n, &s) != 2) return 0;

    sort(num, num+10);

    int ans = 0;
    do {
      int sum = 0;
      for (int i=0; i<n; i++) {
        sum += num[i]*(i+1);
      }
      if (sum == s) ans++;
    } while (next_permutation(num, num+10));

    printf("%d\n", ans/fact[10-n]);
  }
}