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

int memo[1111][11][1111];

int solve(int bit, int n, int s){
  
  if(!n && !s) return memo[bit][n][s] = 1;
  if(!n || s < 0) return memo[bit][n][s] = 0;
  if(~memo[bit][n][s]) return memo[bit][n][s];

  int ans = 0;
  for(int i=0;i<10;i++){
    if(!(bit&(1<<i))) ans += solve(bit|(1<<i), n-1, s-i*n);
  }

  return memo[bit][n][s] = ans;
}

int main(){

  int n, s;
  while(cin >> n >> s){
    memset(memo, -1, sizeof(memo));
    cout << solve(0, n, s) << endl;
  }
  
}