#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)
using Integer = long long;
using Real = long double;
const Real PI = acosl(-1);
using P = pair<int, int>;

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}

template<class T> inline
ostream& operator<<(ostream&os, set<T> v) {
  os << "(set";
  for (T item: v) os << ' ' << item;
  os << ")";
  return os;
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

//           ^   >  v   <
int dx[] = { -1, 0, 1,  0 };
int dy[] = {  0, 1, 0, -1 };

using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;


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;
}