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

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

int rec(int sum,int cnt,int bit){
  if(sum < 0) return 0;
  if(cnt == n) return sum == 0;
  if(dp[sum][cnt][bit]) return dp[sum][cnt][bit];
  int res = 0;
  for(int i=0;i<=9;i++){
    if(bit >> i & 1)
      res += rec(sum - i*(cnt+1),cnt+1,bit & ~(1 << i));
  }
  return dp[sum][cnt][bit] = res;
}
      

int main(){
  while(cin >> n >> s){
    memset(dp,0,sizeof(dp));
    int ans = 0;
    
    cout << rec(s,0,(1 << 10)-1) << endl;
  }
}