import sys
input = sys.stdin.readline

N, P = map(int, input().split())
inf = 10 ** 9
pre = [inf] * (P + 1)
pre[0] = 0
for _ in range(N):
    dp = [inf] * (P + 1)
    a, b, c = map(int, input().split())
    L = [a, b, c, 1]
    for j in range(4):
        v = L[j]
        for i in range(P + 1):
            if i - j < 0:
                continue
            dp[i] = min(dp[i], pre[i - j] + v)

    pre, dp = dp, pre

print(pre[-1]/N)