#include<iostream>
using namespace std;

bool flags[10];

int solve(int index,int sum,int max){
  if(index > max) return 0;
  if(index == max && sum == 0){
    return 1;
  }
  if(sum < 0) return 0;

  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 count;
}

int main(){
  int n,s;
  while(cin>>n>>s){
    cout<<solve(1,s,n+1)<<endl;
  }
  return 0;
}