#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;
  while(~scanf("%d%d",&n,&s)){
    memset(dp,0,sizeof(dp));
    if( s>330 ){
      puts("0");
      continue;
    }
    rep(k,10)dp[1<<k][k] = 1;

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