#include<iostream>
using namespace std;

int n,s;
int dp[350][1<<10];

int rec(int k,int sum,int u){
  int res = 0;
  if(k==0 && sum==0)return 1;
  if(dp[sum][u] >= 0)return dp[sum][u];
  if(k==0)return dp[sum][u] = 0;
  
  for(int i=0;i<10;i++){
    if(u>>i &1){
      if(sum-k*i>=0)res += rec(k-1,sum - k*i,u - (1<<i));
    }
  }
  dp[sum][u] = res;
  return res;
}


int main(){
  for(int i=0;i<350;i++){
    for(int j=0;j<1<<10;j++)dp[i][j] = -1;
  }
  dp[0][0] = 1;
  while(cin >> n >> s)cout << rec(n,s,(1<<10)-1) << endl;
}