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

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define DEB 0

int dp[1<<10][331];

int main(){
  int n,s,comb,x,y;
  rep(k,10)dp[1<<k][k] = 1;

  REP(i,1,10){
    comb = (1<<i)-1;
    while( comb < 1<<10 ){
      rep(j,331)if( dp[comb][j] ){
	rep(k,10)if( !(comb&(1<<k)) ){
	  if( j+(i+1)*k>330 )break;
	  dp[comb|(1<<k)][j+(i+1)*k] += dp[comb][j];
	}
      }
      x = comb & -comb;
      y = comb + x;
      comb = ((comb&~y)/x>>1)|y;
    }
  }
  
  while(~scanf("%d%d",&n,&s)){
    int ans = 0;
    if( s>330 ){
      puts("0");
      continue;
    }
    comb = (1<<n)-1;
    while( comb < 1<<10 ){
      ans += dp[comb][s];
      x = comb & -comb;
      y = comb + x;
      comb = ((comb & ~y)/x>>1)|y;
    }
    printf("%d\n",ans);
  }
  return 0;
}