#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
    int N, P;
    cin >> N >> P;
    ll rank[N+1][4];
    ll a, b, c;
    rep(i,1,N+1){
        cin >> a >> b >> c;
        rank[i][0] = a;
        rank[i][1] = b;
        rank[i][2] = c;
        rank[i][3] = 1;
    }
    
    vector<vector<ll> > dp(N+1, vector<ll>(P+1, 1e18));
    dp[0][0] = 0;
    rep(i,1,N+1) rep(j,0,P+1) rep(k,0,4){
        if(j-k>=0){
            dp[i][j] = min(dp[i-1][j-k] + rank[i][k], dp[i][j]);
        }
    }
    cout <<  (double)dp[N][P]/(double)N << endl; 
    return 0;   
}