#include #pragma warning(disable:4996) using namespace std; using ll = long long; int main() { int N, P; scanf("%d", &N); scanf("%d", &P); vector < vector>v(N, vector(4)); for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { scanf("%lld", &v[i][j]); } v[i][3] = 1; } vectordp(P + 1,0); for (int i = 0; i < N; i++) { for (int j = P; j >= 0; j--) { if(j>=3)dp[j] = min({ dp[j] + v[i][0],dp[j - 1] + v[i][1],dp[j - 2] + v[i][2],dp[j - 3] + v[i][3] }); else if(j==2)dp[j]=min({ dp[j] + v[i][0],dp[j - 1] + v[i][1],dp[j - 2] + v[i][2] }); else if(j==1)dp[j] = min( dp[j] + v[i][0],dp[j - 1] + v[i][1] ); else if (j == 0)dp[j] = dp[j] + v[i][0]; } } float ans = (dp[P]) / ((float)N); printf("%.1f\n", ans); return 0; }