#include using namespace std; #define REP(i, m, n) for (int i = (m); i < (int)(n); i++) #define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define reps(i, n) for (int i = 0; i <= (int)(n); i++) #define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define rreps(i, x) for (int i = (int)(x); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back typedef long long ll; typedef pair P; const int inf = INT_MAX; const ll INF = 1LL << 60; const ll mod = 1e9 + 7; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); } double dp[5001][15001]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, P; cin >> N >> P; vector a(N), b(N), c(N); rep(i, N) cin >> a[i] >> b[i] >> c[i]; Fill(dp, 100000.0); rep(i, 4) dp[0][i] = 0; rep(i, N) reps(j, P) { if (abs(dp[i][j] - 100000) <= 0.01) continue; chmin(dp[i+1][j], ((dp[i][j] * i) + a[i]) / (i + 1)); chmin(dp[i+1][j+1], ((dp[i][j] * i) + b[i]) / (i + 1)); chmin(dp[i+1][j+2], ((dp[i][j] * i) + c[i]) / (i + 1)); chmin(dp[i+1][j+3], ((dp[i][j] * i) + 1) / (i + 1)); } printf("%.12lf\n", dp[N][P]); return 0; }