#include using namespace std; #pragma warning(disable:4996) 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("%d", &v[i][j]); } v[i][3] = 1; } int dp[4]; memset(&dp, 0, sizeof(dp)); for (int i = 0; i < N; i++) { for (int j = 3; 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 = (float)(dp[P]) / N; printf("%.1f\n", ans); return 0; }