import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { auto rd = readln.split.to!(int[]), n = rd[0], p = rd[1]; auto r = new int[][](n, 4); foreach (i; 0..n) r[i] = readln.split.to!(int[]) ~ 1; auto inf = 10^^9; auto dp = new int[][](n+1, p+1); foreach (i; 0..n+1) dp[i][] = inf; dp[0][0] = 0; foreach (i; 0..n) foreach (j; 0..p+1) foreach (k; 0..4) if (j-k >= 0) dp[i+1][j] = min(dp[i+1][j], dp[i][j-k] + r[i][k]); writefln("%.6f", dp[n][p].to!real / n); }