import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) inf = 10 ** 9 N, P = map(int, input().split()) dp = [0] for _ in range(N): a, b, c = map(int, input().split()) ndp = [inf] * (len(dp) + 3) for i in reversed(range(len(dp))): ndp[i + 3] = min(ndp[i + 3], dp[i] + 1) ndp[i + 2] = min(ndp[i + 2], dp[i] + c) ndp[i + 1] = min(ndp[i + 1], dp[i] + b) ndp[i + 0] = min(ndp[i + 0], dp[i] + a) dp = ndp print("{:.12f}".format(dp[P] / N))