import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { alias Tuple!(int, "score", int, "solved", int, "index") node; int N, P, a, b, c; scanf("%d %d", &N, &P); auto A = new int[][](N, 4); node[] B; foreach (i; 0..N) { scanf("%d %d %d", &a, &b, &c); A[i] = [a, b, c, 1]; foreach (j; 0..4) B ~= node(A[i][j]-A[i][0], j, i); } B.sort!"a.score < b.score"(); auto solved = new int[](N); foreach (i; 0..N) solved[i] = -1; foreach (x; B) { if (solved[x.index] > -1) continue; if (x.solved > P) continue; P -= x.solved; solved[x.index] = x.solved; } long ans = 0; foreach (i; 0..N) ans += A[i][solved[i]]; writefln("%.10f", 1.0L * ans / N); }