#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n, s;
  while (cin >> n >> s) {
    int ans = 0;
    for (int i = 0; i < 1 << 10; i++) {
      if (__builtin_popcount(i) != n) continue;
      vector<int> r;
      for (int j = 0; j < 10; j++) {
        if (i >> j & 1) r.emplace_back(j);
      }
      do {
        int sum = 0;
        bool cant = false;
        for (int j = n; j > 0; j--) {
          sum += j * r[j - 1];
          if (sum > s) {
            cant = true;
            break;
          }
        }
        ans += (!cant && sum == s);
      } while (next_permutation(r.begin(), r.end()));
    }
    cout << ans << endl;
  }

  return 0;
}
