function perm(xs, n, s, callback) {
  var
  x, i, len = xs.length;
  s = s || [];
  if(n === 0) {
    callback(s);
  }else{
    for(i = 0; i < len; i++){
      x = xs.shift();
      s.push(x);
      perm(xs, n - 1, s, callback);
      s.pop();
      xs.push(x);
    }
  }
}

function main() {
  var
  i,
  dp = {},
  fact = [1];
  perm([0,1,2,3,4,5,6,7,8,9], 10, [], function(xs) {
    var
    i,
    t = 0;
    for(i = 0; i < 10; i++) {
      t += xs[i] * (i + 1);
      dp[i] = dp[i] || [];
      dp[i][t] = (dp[i][t] || 0) + 1;
    }
  });
  for(i = 1; i <= 9; i++) {
    fact[i] = fact[i - 1] * i;
  }
  
  input.forEach(function(line) {
    var
    n, s;
    if(line.trim() === '') return;
    line = line.split(' ').map(parseFloat);
    n = line[0]; s = line[1];
    if(n < 0 || s >= 331) {
      console.log(0);
    }else if(n === 0) {
      if(s === 0) console.log(1);
      else console.log(0);
    }else{
      console.log(~~(dp[n - 1][s] / fact[10 - n]));
    }
  });
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});