n, p = map(int, input().split()) INF = 10**18 DP = [INF for _ in range(p + 1)] DP[0] = 0 for _ in range(n): a, b, c = map(int, input().split()) NDP = [INF for _ in range(p + 1)] for i in range(p + 1): if DP[i] != INF: NDP[i] = min(NDP[i], DP[i] + a) if i + 1 <= p: NDP[i + 1] = min(NDP[i + 1], DP[i] + b) if i + 2 <= p: NDP[i + 2] = min(NDP[i + 2], DP[i] + c) if i + 3 <= p: NDP[i + 3] = min(NDP[i + 3], DP[i] + 1) DP = NDP print(DP[p] / n)