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