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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define all(v) begin(v),end(v)
#define pb push_back
#define inf (1e9)
#define eps (1e-9)
#typedef long long Integer;

#typedef vector<int> vi;

vi lsi(vi xs) {
  vvi bins;
  vi bots;
  for (int x: xs) {
    auto it = lower_bound(begin(bots), end(bots), x);
    if (it == end(bots)) {
      bins.push_back({x});
      bots.push_back(x);
    } else {
      bins[it - begin(bots)].push_back(x);
      *it = x;
    }
  }
  int n = bots.size();
  vi ret(n);
  int x = inf;
  for (--n; n>=0; --n) {
    reverse(begin(bins[n]), end(bins[n]));
    x = *(lower_bound(begin(bins[n]), end(bins[n]), x) - 1);
    ret[n] = x;
  }
  return ret;
}

int solve(int n, Integer s) {
  vi xs(10);
  vi ys(n);
  rep (i, 10) xs[i] = i;
  set<vi> aa;
  do {
    Integer t = 0;
    rep (i, n) {
      t += xs[i] * (i+1);
      ys[i] = xs[i];
    }
    if (t == s) {
      aa.insert(ys);
    }
  } while (next_permutation(all(xs)));
  return aa.size();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  random_device dev;
  mt19937 rand(dev());

  int n; Integer s;
  while (cin >> n >> s) {
    cout << solve(n, s) << endl;
  }

  return 0;
}