#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+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 > dp(N+1, vector(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]); } } double ans = (double)dp[N][P]/(double)N; printf("%.6f\n", ans); return 0; }