#include #define rep(i,a,b) for(int i=a;i=b;i--) using namespace std; typedef long long ll; typedef pair P; int main(){ int N, P; cin >> N >> P; ll rank[N][4]; ll a, b, c; rep(i,0,N){ cin >> a >> b >> c; rank[i][0] = a; rank[i][1] = b; rank[i][2] = c; rank[i][3] = 1; } vector > dp(2, vector(P+1, 1e18)); dp[0][0] = 0; rep(i,0,N) { rep(j,0,P+1) rep(k,0,4){ if(j-k>=0){ dp[1][j] = min(dp[0][j-k] + rank[i][k], dp[1][j]); } } rep(j,0,P+1){ dp[0][j] = dp[1][j]; dp[1][j] = 1e18; } } double ans = (double)dp[0][P]/(double)N; printf("%.5f\n", ans); return 0; }