
import std.stdio;
import std.array;
import std.conv;
import std.string;
import std.algorithm;

uint solve(uint set, uint n, uint s, uint curr, uint index) {
  if (curr > s) return 0;
  if (n == 0) {
    if (curr == s) return 1;
    else return 0;
  }
  uint sum = 0;
  for(int i = 0; i <= 9; i++) {
    if (((set >> i) & 1) == 0) {
      sum += solve(set | (1 << i), n - 1, s, curr + index * i, index + 1);
    }
  }
  return sum;
}

void main() {
  while(true) {
    string line = readln.chomp;
    // foreach(ref col; table) foreach(ref x; col) x = -1;
    if (stdin.eof) break;
    uint[] data = line.split(" ").map!(to!(uint)).array;
    solve(0, data[0], data[1], 0, 1).writeln;
    break;
  }
}