#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; int n, m; struct S { double a, b, p; }; vector d; double e[1 << 12][41]; bool valid[1 << 12][41]; double dfs(int s, int w) { if (s == (1 << n) - 1) return 0; if (valid[s][w]) return e[s][w]; valid[s][w] = true; if (w == m) { double res = 0; rep(i, n) if (!(s >> i & 1)) res += d[i].a; return e[s][w] = res; } double mx = 0; rep(i, n) if (!(s >> i & 1)) { auto [a, b, p] = d[i]; chmax(mx, a + dfs(s | 1 << i, w)); chmax(mx, p * (b + dfs(s | 1 << i, w)) + (1 - p) * dfs(s, w + 1)); } return e[s][w] = mx; } } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; d.resize(n); for (auto& [a, b, p] : d) { int ai, bi, pi; cin >> ai >> bi >> pi; a = 1.0 / ai; b = 1.0 / bi; p = 1.0 / pi; } double ans = dfs(0, 0); cout << fixed << setprecision(15) << ans << endl; }