#include <iostream>
#include <cstring>

using namespace std;

int n,s;
int dp[10][400];
bool used[10];
int cnt;

int solve(int k,int sum){
  if(sum > s) return 0;

  if(n == k){
    if(sum == s){
      return 1;
    }
    return 0;
  }

  if(n == k+1){
    if(sum == s && !used[0]){
      return 1;
    }
  }

  int res = 0;
  for(int i = 9 ; i >= 0 ; i--){
    if(!used[i]){
      used[i] = true;
      res += solve(k + 1 , sum + ((k+1)*i));
      used[i] = false;
    }
  }  

  return dp[n][s] = res;
}

int main(){
  while(cin >> n >> s){
    if(s > 330 || n == 0){
      cout << "0" << endl;
      continue;
    }

    if(dp[n][s]){
      cout << dp[n][s] << endl;
    }else{
      cnt = 0;
      memset(used,false,sizeof(used));
      cout << solve(0,0) << endl;
    }
  }
  
  return 0;
}