#include #include using namespace std; #define REP(i,n) for(int i=0;i<(int)(n);++i) #define CHMIN(a,b) a=min((a),(b)) #define CHMAX(a,b) a=max((a),(b)) int n,p; int dp[2][15252]; int vs[5252][4]; const int INF = 1<<30; int main(){ scanf("%d%d",&n,&p); REP(i,n)scanf("%d%d%d",vs[i]+0,vs[i]+1,vs[i]+2); fill(dp[0],dp[0]+p+1,INF); int cur = 0; dp[cur][0] = 0; REP(i,n){ vs[i][3] = 1; fill(dp[cur^1],dp[cur^1]+p+1,INF); REP(k,4)REP(j,p+1)CHMIN(dp[cur^1][j+k],dp[cur][j]+vs[i][k]); cur ^= 1; } printf("%.10f\n",(double)dp[cur][p] / n); return 0; }