{"problem":{"name":"Infinite Knapsack","description":{"content":"There are $N$ kinds of items, each with infinitely many copies. The $i$\\-th kind of item has a weight of $A_i$, a volume of $B_i$, and a value of $C_i$. Level $X$ Takahashi can carry items whose total","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc275_g"},"statements":[{"statement_type":"Markdown","content":"There are $N$ kinds of items, each with infinitely many copies. The $i$\\-th kind of item has a weight of $A_i$, a volume of $B_i$, and a value of $C_i$.\nLevel $X$ Takahashi can carry items whose total weight is at most $X$ and whose total volume is at most $X$. Under this condition, it is allowed to carry any number of items of the same kind, or omit some kinds of items.\nLet $f(X)$ be the maximum total value of items Level $X$ Takahashi can carry. It can be proved that the limit $\\displaystyle\\lim_{X\\to \\infty} \\frac{f(X)}{X}$ exists. Find this limit.\n\n## Constraints\n\n*   $1\\leq N\\leq 2\\times 10^5$\n*   $10^8\\leq A_i,B_i,C_i \\leq 10^9$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$ $C_1$\n$A_2$ $B_2$ $C_2$\n$\\vdots$\n$A_N$ $B_N$ $C_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc275_g","tags":[],"sample_group":[["2\n100000000 200000000 100000000\n200000000 100000000 100000000","0.6666666666666667\n\nWhen $X=300000000$, Takahashi can carry items whose total weight is at most $300000000$ and whose total volume is at most $300000000$.\nHe can carry, for instance, one copy of the $1$\\-st item and one copy of the $2$\\-nd item. Then, the total value of the items is $100000000+100000000=200000000$. This is the maximum achievable value, so $\\dfrac{f(300000000)}{300000000}=\\dfrac{2}{3}$.\nIt can also be proved that $\\displaystyle\\lim_{X\\to \\infty} \\frac{f(X)}{X}$ equals $\\dfrac{2}{3}$. Thus, the answer is $0.6666666...$."],["1\n500000000 300000000 123456789","0.2469135780000000"]],"created_at":"2026-03-03 11:01:14"}}