n, p = map(int, input().split()) dp = [[10**9] * (p + 1) for i in range(n + 1)] dp[0][0] = 0 for i in range(n): a, b, c = map(int, input().split()) for j in range(p + 1): dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + a) if j < p: dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + b) if j + 1 < p: dp[i + 1][j + 2] = min(dp[i + 1][j + 2], dp[i][j] + c) if j + 2 < p: dp[i + 1][j + 3] = min(dp[i + 1][j + 3], dp[i][j] + 1) print(float(dp[n][p]) / float(n))