/** author: shobonvip created: 2026.08.25 14:58:41 **/ #include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) #define all(v) v.begin(), v.end() template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } typedef long double ld; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int x, y; cin >> x >> y; vector wt(n), vt(n), ct(n); vector w, v; rep(i,0,n) { cin >> wt[i] >> vt[i] >> ct[i]; int g = 1; while (g * 2 < ct[i]) { g *= 2; } ct[i] -= g; if (ct[i] > 0) { w.emplace_back(wt[i] * ct[i]); v.emplace_back(vt[i] * ct[i]); } g >>= 1; while (g > 0) { w.emplace_back(wt[i] * g); v.emplace_back(vt[i] * g); g >>= 1; } w.emplace_back(wt[i]); v.emplace_back(vt[i]); } n = w.size(); ld ub = 100000; ld lb = 0; auto check = [&](ld k) { vector dp(n+1, vector(x, -1e18)); rep(i,0,n) { int opt = w[i] / x; chmax(dp[i+1][w[i]%x], v[i] + ld(opt) * y - k * w[i]); rep(j,0,x) { chmax(dp[i+1][j], dp[i][j]); if ((j+w[i]) % x < j) { chmax( dp[i+1][(j+w[i]) % x], dp[i][j] + v[i] + ld(opt+1) * y - k * w[i] ); } else { chmax( dp[i+1][(j+w[i]) % x], dp[i][j] + v[i] + ld(opt) * y - k * w[i] ); } } } return max(dp[n]) >= 0; }; rep(num,0,50) { ld k = (ub + lb) / 2; if (check(k)) lb = k; else ub = k; } cout << fixed << setprecision(15); cout << lb << '\n'; }