
fun main(args:Array<String>):Unit {
    while(true){
        val (n, m) = (readLine() ?: return).trim().split(' ').map(String::toInt)
        val maximizeByVocal = Array(m + 1){0}
        val maximizeByDance = Array(m + 1){0}
        val maximizeByLooks = Array(m + 1){0}
        repeat(n){
            readLine()
            val (c, v, d, l) = readLine()!!.trim().split(' ').map(String::toInt)
            val by = Bydol(c, v, d, l)
            for (j in 0 .. (m - by.cost)){
                if (maximizeByVocal[j + by.cost] < maximizeByVocal[j] + by.vocal)
                    maximizeByVocal[j + by.cost] = maximizeByVocal[j] + by.vocal
                if (maximizeByDance[j + by.cost] < maximizeByDance[j] + by.dance)
                    maximizeByDance[j + by.cost] = maximizeByDance[j] + by.dance
                if (maximizeByLooks[j + by.cost] < maximizeByLooks[j] + by.looks)
                    maximizeByLooks[j + by.cost] = maximizeByLooks[j] + by.looks
            }
        }
        println(listOf(maximizeByVocal.max()!!, maximizeByDance.max()!!, maximizeByLooks.max()!!).max())
    }
}
data class Bydol(val cost:Int, val vocal:Int, val dance:Int, val looks:Int)
