import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val (N, P) = Pair(sc.nextInt(), sc.nextInt())
    val q = Array(N, { arrayOf(sc.nextInt(), sc.nextInt(), sc.nextInt() )})
    val inf = 100000L*N
    val dp = LongArray(P+4)
    dp.fill(inf)
    dp[3] = 0
    for (i in 0 until N) {
        for (dest in Math.min(3*i+6, P+3) downTo 3) {
            dp[dest] = Math.min(Math.min(Math.min(dp[dest]+q[i][0], dp[dest-1]+q[i][1]), dp[dest-2]+q[i][2]), dp[dest-3]+1)
        }
    }
    println(dp[P+3].toDouble() / N.toDouble())
}