#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
#define sz(c) (int((c).size()))

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

int combo(int n, int s)
{
  v.clear();
  for (int i = n; sz(v) < 10; i--) {
    v.pb(i>0?i:0);
  }
  int res = 0;
  do {
    int accm = 0;
    for (int i = 0; i < 10; i++) {
      if (v[i])
        accm += v[i]*k[i];
      if (accm>s)
        break;
    }
    if (accm == s)
      res++;
  } while (prev_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;
}