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

int factorial(int n) {
  int f = 1;
  for(int i = 2; i <= n; ++i) f *= i;
  return f;
}

int main() {
  int ary[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  for(int N, S; cin >> N >> S; ) {
    sort(ary, ary + 10);
    int ans = 0;
    do {
      int s = 0;
      for(int i = 0; i < N; ++i) {
        s += (i + 1) * ary[i];
      }
      if(s == S) ans++;
    } while(next_permutation(ary, ary + 10));
    ans /= factorial(10 - N);
    cout << ans << endl;
  }
}