#define _USE_MATH_DEFINES #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int MOD = 998244353; // constexpr int MOD = 1000000007; constexpr int DY4[]{1, 0, -1, 0}, DX4[]{0, -1, 0, 1}; constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1}; constexpr int DX8[]{0, -1, -1, -1, 0, 1, 1, 1}; template inline bool chmax(T& a, U b) { return a < b ? (a = b, true) : false; } template inline bool chmin(T& a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << fixed << setprecision(20); } } iosetup; int main() { constexpr int T = 60; int n, k; cin >> n >> k; vector p(n), s(n), t(n); REP(i, n) cin >> p[i] >> s[i] >> t[i]; if (accumulate(ALL(t), 0) > T) { cout << "-1\n"; return 0; } if (accumulate(ALL(s), 0) <= T) { cout << 1 << ' ' << 1 << ' ' << 1 << '\n'; return 0; } int x_max = 0; double ans = 0; map, double> dp{{vector(n, k + 1), 1}}; for (int d = k + 2; !dp.empty(); ++d) { x_max = d; map, double> nxt; for (const auto& [v, prob] : dp) { int start = 0; REP(i, n) { if (v[i] < p[i]) start |= 1 << i; } if (start == 0) { ans += prob * d; } else { for (int subset = start; ;) { int tm = 0; double nxt_prob = prob; vector nxt_v = v; REP(i, n) { if (subset >> i & 1) { tm += s[i]; nxt_prob *= static_cast(p[i] - v[i]) / (v[i] - k + p[i] - v[i]); ++nxt_v[i]; } else { tm += t[i]; if (start >> i & 1) nxt_prob *= static_cast(v[i] - k) / (v[i] - k + p[i] - v[i]); } } if (tm <= T) { ans += nxt_prob * d; } else { nxt[nxt_v] += nxt_prob; } if ((subset = (subset - 1) & start) == start) break; } } } dp.swap(nxt); } cout << k + 2 << ' ' << x_max << ' ' << ans << '\n'; return 0; }