fun main(args:Array<String>?): Unit {
    val price = arrayOf(6000, 4000, 3000, 2000)
    println(Array(4){readLine()!!.trim().split(' ').map(String::toInt).let{price[it[0]-1]*it[1]}}.joinToString("\n"))
}
