#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef vector<int> vi;
#define all(c) begin(c), end(c)
#define pb push_back

vi v;
vi k{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

int combo(int n, int s)
{
  v.assign(10, 0);
  int i = 10 - n;
  int j = 1;
  for (; i < 10; i++, j++) {
    v[i] = j;
  }
  int res = 0;
  do {
    int accm = 0;
    for (int i = 0; i < 10; i++) {
      accm += v[i]*k[i];
    }
    if (accm == s)
      res++;
  } while (next_permutation(all(v)));
  return res;
}

int main(int argc, char **argv)
{
  int n, s;
  while (cin >> n >> s) {
    cout << combo(n, s) << endl;
  }
  return 0;
}