#include<iostream>
#include<cstring>
using namespace std;
int dp[11][1<<10][331];
int ans(int n, int x, int s);
int main(){
  int n,m;
  memset(dp,-1,sizeof(dp));
  while(cin >>n>>m){
    if(n>10 || 330<m){cout <<"0"<<endl;}
    else{cout <<ans(n,0,m)<<endl;}
  }
  return 0;
}
int ans(int n, int x, int s){
  int y = 0;
  if(dp[n][x][s]>=0){return dp[n][x][s];}
  if(s<0){return 0;}
  if(n == 1){
    if(s<10){
      if(!(x&(1<<s))){y = 1;}
    }
  }
  else{
    for(int i=0; i<10; i++){
      if(!(x&(1<<i))){
	y+=ans(n-1,x|(1<<i),s-i*n);
      }
    }
  }
  dp[n][x][s] = y;
  return y;
}