object Main extends App {
  val max = (0 to 9).toList.zip((1 to 10).toList).map { case (a, b) ??? a * b }.sum
  val memo = (for (_ ??? 0 to max) yield (new Array[Int](10))).toArray
  def go(n: Int, ulist: UsedList, s: Int): Unit = {
    //println(n, s)
    lazy val func = (0 to 9).toList.filter { ulist.canUse(_) }.foreach { num ??? go(n + 1, ulist.useNum(num), s + (n + 1) * num) }
    n match {
      case 0  ??? func
      case 10 ??? memo(s)(n - 1) += 1
      case _ ???
        memo(s)(n - 1) += 1
        func
    }
  }
  go(0, new UsedList, 0)
  for (line ??? scala.io.Source.stdin.getLines) {
    val n :: s :: _ = line.split(" ").map(_.toInt).toList
    println(memo(s)(n - 1))
  }
}
class UsedList(private val num: Int = 0) {
  def canUse(n: Int): Boolean = {
    return ((num & (1 << n)) == 0)
  }
  def useNum(n: Int): UsedList = {
    return new UsedList(num | (1 << n))
  }
}