#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

// int MOD = 998244353;
int MOD = 1000000007;

ll dp[5001][15001] = {0};

//----------------------------------------------------------------
signed main(){

	ll n,p;
	cin >> n >> p;

	vll a(n),b(n),c(n);
	rep(i,n) cin >> a[i] >> b[i] >> c[i];

	for(int i = 0;i < n;i++){
		for(int j = 0;j <= p;j++){
			dp[i+1][j] = dp[i][j] + a[i];
			if(j >= 1) dp[i+1][j] = min(dp[i+1][j],dp[i][j-1]+b[i]);
			if(j >= 2) dp[i+1][j] = min(dp[i+1][j],dp[i][j-2]+c[i]);
			if(j >= 3) dp[i+1][j] = min(dp[i+1][j],dp[i][j-3]+1);
		}
	}

	// cout << dp[n][p]*1.0/n << endl;
	printf("%0.10lf\n",dp[n][p]*1.0/n);
	

	return 0;
}

//----------------------------------------------------------------

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://dp.contest.atcoder.jp/tasks/dp_a
// rm -r -f test;oj dl https://abc054.contest.atcoder.jp/tasks/abc054_d