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

bool flags[10];
int solved[1024][331];

int trans(){
  int a=0;
  for(int i=0;i<10;i++)
    a+= ( int(flags[i])<<i );
  return a;
}

int solve(int index,int sum,int max){
  int a=trans();
  if(sum < 0 || sum>330 || index > max){ return 0; } 
  if(index == max && sum == 0){
    return solved[a][0]=1;
  }

  if(solved[a][sum]!=-1) return solved[a][sum];
  int count=0;
  for(int i=0;i<10;i++){
    if(!flags[i]){
      flags[i]=true;
      int s=solve(index+1,sum-index*i,max);
      count+=s;
      flags[i]=false;
    }
  }
  return solved[a][sum]=count;
}

int main(){
  int n,s;
  while(cin>>n>>s){
    for(int i=0;i<1024;i++)
      for(int j=0;j<331;j++)
	solved[i][j]=-1;
    cout<<solve(1,s,n+1)<<endl;
  }
  return 0;
}