/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.05 01:44:48 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n,p;cin >> n >> p; vector> dp(n+1,vector(p+1,0)); dp[0][0] = 0; for (int i = 0; i < n; i++) { int a,b,c;cin >> a >> b >> c; for (int j = 0; j <= p; j++) { dp[i + 1][j] = (dp[i][j] * i + a) / (i + 1); if (j - 1 >= 0) dp[i + 1][j] = min(dp[i + 1][j],(dp[i][j-1] * i + b) / (i + 1)); if (j - 2 >= 0) dp[i + 1][j] = min(dp[i + 1][j],(dp[i][j-2] * i + c) / (i + 1)); if (j - 3 >= 0) dp[i + 1][j] = min(dp[i + 1][j],(dp[i][j-3] * i + 1) / (i + 1)); } } printf("%.10f",dp[n][p]); return 0; }