object Main extends App {
  val max = (for (a <- 0 to 9) yield (a * (a + 1))).sum
  val memo = (for (_ <- 0 to max) yield { for (_ <- 0 to 9) yield (0) }.toArray).toArray

  def go(num: Int, sum: Int, numbers: Numbers = new Numbers): Unit = {
    num match {
      case 11 => Unit
      case _ =>
        (0 to 9).filter { numbers.canUseNum(_) }.foreach { number =>
          memo(sum + num * number)(num - 1) += 1
          go(num + 1, sum + num * number, numbers.useNum(number))
        }
    }
  }
  go(1, 0)
  for (line <- scala.io.Source.stdin.getLines) {
    val n :: s :: _ = line.split(" ").map(_.toInt).toList
    if (s <= max) println(memo(s)(n - 1))
    else println(0)
  }
}
class Numbers(private val num: Int = 0) {
  def canUseNum(n: Int): Boolean = {
    (num & (1 << n)) == 0
  }
  def useNum(n: Int): Numbers = {
    new Numbers(num | (1 << n))
  }
}