N, M = map(int, input().split()) ABP = [[1./v for v in map(int,input().split())] for _ in range(N)] dp = [-float('inf')] * 4096 full_bit = (1 << N) - 1 for _ in range(M + 1): ndp = dp.copy() ndp[0] = 0. for i in range(1, N + 1): bi = (1 << i) - 1 while bi <= full_bit: s = 0. pi = bi while pi > 0: pbit = pi & -pi pidx = (pbit - 1).bit_length() dpi = bi ^ pbit a, b, p = ABP[pidx] s = max(s, ndp[dpi] + a, (ndp[dpi] + b) * p + dp[bi] * (1. - p)) pi &= pi - 1 ndp[bi] = max(ndp[bi], s) x = bi & -bi y = bi + x bi = ((bi & ~y) >> x.bit_length()) | y dp = ndp print(dp[full_bit])