#include //#define int long long using namespace std; using LL = long long; using P = pair; using Tapris = tuple; #define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() const int INF = (int)1e9; const LL INFL = (LL)1e15; const int MOD = 1e9 + 7; int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; /*************** using variables ***************/ int n, p; int a[5005][4]; int dp[15005]; /**********************************************/ signed main(){ cin >> n >> p; REP(i, n) cin >> a[i][0] >> a[i][1] >> a[i][2], a[i][3] = 1; REP(i, n+1) dp[i] = INF; dp[0] = a[0][0]; dp[1] = a[0][1]; dp[2] = a[0][2]; dp[3] = 1; FOR(i, 1, n){ int tmp[15005]; for(int j = 0; j <= p; j++){ int min_num = INF; REP(k, 4){ if(j >= k){ min_num = min(min_num, a[i][k] + dp[j-k]); } } tmp[j] = min_num; } for(int j = 0; j <= p; j++) dp[j] = tmp[j]; } printf("%.9f\n" ,(double)dp[p] / n); }