#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 vector<int> vi;

int solve(int n, int s) {
  vi xs(10);
  vi ys(n);
  rep (i, 10) xs[i] = i;
  set<vi> aa;
  do {
    int 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);

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

  return 0;
}