#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int hoge(int n, int s, vector<int> seq = {}) {
  int sum = 0;

  if (seq.size() != n) {
    int start = seq.empty() ? 0 : *seq.rbegin() + 1;
    for (int i = start; i < 10; ++i) {
      vector<int> tmp = seq;
      tmp.push_back(i);
      sum += hoge(n, s, tmp);
    }
  } else {
    do {
      int s2 = 0;
      for (int i = 0; i < n; ++i)
        s2 += seq[i] * (i + 1);
      sum += int(s2 == s);
    } while (next_permutation(seq.begin(), seq.end()));
  }

  return sum;
}

int main() {
  int n, s;

  while (cin >> n >> s)
    cout << hoge(n, s) << endl;
}
