#include<stdio.h>
#include<stdlib.h>

#define MIN(a,b) ((a)<(b)?(a):(b))

void run(void){
  int n,p;
  scanf("%d%d",&n,&p);
  int *dp=(int *)calloc(p+4,sizeof(int))+3;
  int i;
  for(i=-3;i<=p;i++) dp[i]=100000*n+1;
  dp[0]=0;
  for(i=1;i<=n;i++){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    for(int j=MIN(p,3*i);j>=0;j--){
      dp[j]=MIN(dp[j]+a,MIN(dp[j-1]+b,MIN(dp[j-2]+c,dp[j-3]+1)));
    }
  }
  printf("%.6f\n",(double)dp[p]/n);
}

int main(void){
  run();
  return 0;
}