#include using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; int n, p, dp[15005]; const int INF = 1000000007; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> n >> p; fill(dp, dp+3*n+1, INF); dp[0] = 0; FOR(i, n) { int v[4]; FOR(k, 3) cin >> v[k]; v[3] = 1; // if (i == 0) { // FOR(k, 4) dp[k] = v[k]; // } // else { vector x(p+1); FOR(i, p+1) x[i] = INF; FOR(j, p+1) { FOR(k, 4) { if (j+k <= p) x[j+k] = min(x[j+k], dp[j]+v[k]); } } FOR(j, p+1) dp[j] = x[j]; // } } printf("%.10lf\n", dp[p]/(double)n); return 0; }