#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000

int main() {
    int N, P; cin >> N >> P;
    int a[N], b[N], c[N];
    
    for (int i=0; i<N; i++) cin >> a[i] >> b[i] >> c[i];
    
    int dp[2][P+1];
    
    for (int i=0; i<=P; i++) {
        dp[0][i] = 0;
    }
    
    for (int i=0; i<N; i++) {
        for (int j=0; j<=P; j++) {
            dp[(i+1)&1][j] = INF;
        }
        
        for (int j=0; j<=P; j++) {
            dp[(i+1)&1][j] = min(dp[(i+1)&1][j], dp[i&1][j]+a[i]);
            
            if (j+1<=P) {
                dp[(i+1)&1][j+1] = min(dp[(i+1)&1][j+1], dp[i&1][j]+b[i]);
            }
            
            if (j+2<=P) {
                dp[(i+1)&1][j+2] = min(dp[(i+1)&1][j+2], dp[i&1][j]+c[i]);
            }
            
            if (j+3<=P) {
                dp[(i+1)&1][j+3] = min(dp[(i+1)&1][j+3], dp[i&1][j]+1);
            }
        }
    }
    
    cout << setprecision(10) << (float)dp[N&1][P]/N << endl;
}