var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
arr.forEach(function(v){
   var ns=v.split(" ").map(Number);
   var n=ns[0];
   var s=ns[1];
   var ten=[0,1,2,3,4,5,6,7,8,9];
   var dp=[];
   for(var i=0;i<=n;i++){
      dp[i]=[];
      for(var j=0;j<=330;j++){
         dp[i][j]={};
      }
   }
   for(var i=0;i<=9;i++)dp[1][i][""+i]=1;
   for(var i=1;i<n;i++){
      for(var sum=0;sum<=330;sum++){
         for(var k in dp[i][sum]){
            var ary=k.split("").map(Number);
            var f=ten.filter(function(v){return ary.indexOf(v)==-1});
            f.forEach(function(value){
               var str=(k+value).split("").sort(function(a,b){return a-b;}).join("");
               if(dp[i+1][sum+value*(i+1)].hasOwnProperty(str)==false)dp[i+1][sum+value*(i+1)][str]=1;
               else dp[i+1][sum+value*(i+1)][str]+=1;
            });
         }
      }
   }

   var cnt=0;
   for(var k in dp[n][s])cnt+=dp[n][s][k];
   console.log(cnt);
});