#include #include #include #include #include #include #include #include #include #include #include #include #include const int MOD = 1e9 + 7; const int iINF = 1000000000; const long long int llINF = 1000000000000000000; #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long int; using P = pair; using edge = struct { int to; int cost; }; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; //dp[i][j] := i番目までのコンテストで,j問解いた時の順位の合計の最小値 int dp[2][15010]; int input[4]; int main() { int N, P; cin >> N >> P; input[3] = 1; rep(i, 2) rep(j, P + 1) dp[i][j] = iINF; dp[0][0] = 0; rep(i, N) { rep(j, 3) cin >> input[j]; rep(j, P + 1) { rep(x, 4) { if(j - x < 0) continue; dp[1][j] = min(dp[1][j], dp[0][j - x] + input[x]); } } swap(dp[0], dp[1]); fill(dp[1], dp[1] + P, iINF); } printf("%.9f\n", (double)dp[0][P] / (double)N); return 0; }