import scala.io.StdIn.{readLine,readInt}

object Main extends App {
  for(i<-1 to 4) {
    val s = readLine.split(" ").map(_.toInt)
    s(0) match {
      case 1 => println(6000*s(1))
      case 2 => println(4000*s(1))
      case 3 => println(3000*s(1))
      case 4 => println(2000*s(1))
      case _ => throw new Exception("unexpected error")
    }
  }
}