function perm(xs, n) {
 var
 x, i, len = xs.length,
 ret = [];
 if(n === 0) return [[]];
 for(i = 0; i < len; i++){
  x = xs.shift();
  ret = ret.concat(perm(xs, n - 1).map(function(ys){
   return (ys.unshift(x), ys);
  }));
  xs.push(x);
 }
 return ret;
}

function main() {
  input.forEach(function(line) {
    var
    n, s,
    r = 0;
    if(line.trim() === '') return;
    line = line.split(' ').map(parseFloat);
    n = line[0]; s = line[1];
    perm([0,1,2,3,4,5,6,7,8,9], n).forEach(function(xs) {
      r += xs.reduce(function(m, x, i) {
        return m + x * (i + 1);
      }, 0) === s ? 1 : 0;
    });
    console.log(r);
  });
}

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();
});