#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, s;
  while (cin >> n >> s) {
    int N = (1 << 10);
    vector<vector<int>> v;
    for (int i = 0; i < N; ++i) {
      vector<int> t;
      if (__builtin_popcount(i) == n) {
        for (int j = 0, k = 1; j < 10; k <<= 1, ++j) {
          if (i & k) {
            t.emplace_back(j);
          }
        }
      }
      v.emplace_back(t);
    }
    int cnt = 0;
    for (auto& vv : v) {
      sort(begin(vv), end(vv));
      do {
        int sum = 0;
        for (int i = 0; i < vv.size(); ++i) {
          sum += vv[i] * (i + 1);
        }
        if (sum == s) cnt++;
      } while (next_permutation(begin(vv), end(vv)));
    }
    cout << cnt << endl;
  }
}