def rank(a,b,c,p): if p==0: return a elif p==1: return b elif p ==2: return c else: return 1 def sumrank(a,b,c,N,P): if N == 1: return rank(a[0],b[0],c[0],P) else: maxlastp = min(P,3) minlastp = max(0,P - 3*(N-1)) result = [] for lastp in range(minlastp,maxlastp +1): result.append(sumrank(a[0:N-1],b[0:N-1],c[0:N-1],N-1,P-lastp) + rank(a[N-1],b[N-1],c[N-1],lastp)) return min(result) def averagerank(a,b,c,N,P): return float(sumrank(a,b,c,N,P))/float(N) input = raw_input() N=int(input.split(' ')[0]) P =int(input.split(' ')[1]) a = [] b = [] c = [] for i in range(N): input = raw_input() a.append(int(input.split(' ')[0])) b.append(int(input.split(' ')[1])) c.append(int(input.split(' ')[2])) print averagerank(a,b,c,N,P)