#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

int n, s, ret, dp[15][1010];

signed main(void)
{
  VI data;
  REP(i, 10) data.PB(i);
  do {
    int tmp = 0;
    REP(i, 10) {
      tmp += data[i]*(i+1);
      dp[i][tmp]++;
    }
  } while(next_permutation(ALL(data)));

  int fact[15] = {0};
  fact[0] = 1;
  FOR(i, 1, 10) fact[i] = fact[i-1]*i;

  while(cin >> n >> s) {
    if(s > 1000) {cout << 0 << endl; continue;}
    cout << dp[n-1][s]/fact[10-n] << endl;
  }

  return 0;
}