N, P = map(int, input().split()) abc = [tuple(map(int, input().split())) for _ in range(N)] dp = [[10**18]*(P+1) for _ in range(N+1)] dp[0][0] = 0 for i in range(N): ai, bi, ci = abc[i] for j in range(P+1): dp[i+1][j] = min(dp[i+1][j], dp[i][j]+ai) if j+1<=P: dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]+bi) if j+2<=P: dp[i+1][j+2] = min(dp[i+1][j+2], dp[i][j]+ci) if j+3<=P: dp[i+1][j+3] = min(dp[i+1][j+3], dp[i][j]+1) print(dp[N][P]/N)