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

int n,s,dp[300][16][1 << 10];

int rec(int sum,int cnt,int bit){
  if(cnt == n) return sum == s;
  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(i*(cnt+1)+sum,cnt+1,~(bit >> i & 1));
    }
  }
  return dp[sum][cnt][bit] = res;
}
      

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