#include <iostream>
#include <algorithm>
using namespace std;

#define N_MAX 10
#define SUM_MAX 500

int n, s;
int dp[1<<10][N_MAX+1][SUM_MAX];

void solve() {
  for(int S = (1<<10)-1; S >= 0; S--) {
    for(int t = 0; t <= N_MAX; t++) {
      for(int u = 0; u < SUM_MAX; u++) {
	dp[S][t][u] = (t == 0 && u == 0) ? 1 : 0;
      }
    }
  }

  for(int S = (1<<10)-2; S >= 0; S--) {
    for(int t = 1; t <= N_MAX; t++) {
      for(int u = 0; u < SUM_MAX; u++) {
	for(int k = 0; k <= 9; k++) {
	  if(S>>k & 1) continue;
	  if(u-t*k < 0) break;
	  dp[S][t][u] += dp[S|1<<k][t-1][u-t*k];
	}
      }
    }
  }
}

main() {
  solve();
  while((cin >> n >> s)) cout << dp[0][n][s] << endl;
}