import java.util.* fun main(args: Array) { val sc = Scanner(System.`in`) val (N, P) = Pair(sc.nextInt(), sc.nextInt()) val q = Array(N, { arrayOf(sc.nextInt(), sc.nextInt(), sc.nextInt(), 1 )}) var dp = Array(P+4, { 0L }) val filled_dp = Array(P+4, { 100000000000L }) for (i in 0 until N) { val max_n = 4*i val _dp: Array = filled_dp.clone() for (j in 0 until 4) { for (k in Math.min(max_n, P+3-j) downTo 0) { _dp[k+j] = Math.min(_dp[k+j], dp[k]+q[i][j]) } } dp = _dp } println(dp.take(P+1).min()!!.toDouble() / N.toDouble()) }