# -*- coding: utf-8 -*- N, P = map(int, raw_input().split()) dp = [10**9 + 7]*(P + 5) for i in xrange(N): a, b, c = map(int, raw_input().split()) if i == 0: dp[:4] = [a, b, c, 1] continue for j in xrange(P, -1, -1): dp[j] = dp[j] + a if j > 0: dp[j] = min(dp[j], dp[j - 1] + b) if j > 1: dp[j] = min(dp[j], dp[j - 2] + c) if j > 2: dp[j] = min(dp[j], dp[j - 3] + 1) print "%.10f" % (1.0*dp[P]/N)