#include <iostream>
#include <cstdio>
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][256];

int main(){
  int n,s;
  while(~scanf("%d%d",&n,&s)){
    rep(i,1<<10)rep(j,256)dp[i][j]=0;

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