#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 + 10,0); for (int i = 0; i < N; i++) { for (int j = P; j >= 0; j--) { dp[j+3] = min({ dp[j+3] + v[i][0],dp[j+2] + v[i][1],dp[j+1] + v[i][2],dp[j] + v[i][3] }); dp[j + 2] = min({ dp[j + 2] + v[i][0],dp[j + 1] + v[i][1],dp[j] + v[i][2] }); dp[j + 1] = min( dp[j + 1] + v[i][0],dp[j] + v[i][1] ); dp[j] = dp[j] + v[i][0]; } } float ans = (dp[P]) / ((float)N); printf("%.1f\n", ans); return 0; }