import sys stdin=sys.stdin ip=lambda: int(sp()) fp=lambda: float(sp()) lp=lambda:list(map(int,stdin.readline().split())) tp=lambda:tuple(map(int,stdin.readline().split())) sp=lambda:stdin.readline().rstrip() yp=lambda:print('Yes') np=lambda:print('No') n,p=lp() inf=float('inf') dp=[inf for _ in range(p+1)] dp[0]=0 for _ in range(n): now=lp() for i in range(p,-1,-1): dp[i]+=now[0] if i-1>=0: dp[i]=min(dp[i-1]+now[1],dp[i]) if i-2>=0: dp[i]=min(dp[i-2]+now[2],dp[i]) if i-3>=0: dp[i]=min(dp[i-3]+now[3],dp[i]) print(dp[-1]/n)