| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 512 MB | 5 | 2 | 2 | 100.000% |
A mage knows $n$ spells, the $i$-th of which requires $q_i$ blue mana, $w_i$ purple mana and $e_i$ orange mana ($q_i + w_i + e_i > 0$). Let's say the mage has $Q$ blue mana, $W$ purple mana and $E$ orange mana, and denote the total amount of mana $Q + W + E$ as $R$. Knowing that the mage is unable to cast any spell, what can be the maximal value of $R$?
The first line contains an integer $n$ (1ドル \le n \le 200000$) --- the number of spells.
Each of the next $n$ lines contains three integers $q_i,ドル $w_i,ドル $e_i$ (0ドル \le q_i, w_i, e_i \le 10^{9}, q_i + w_i + e_i > 0$) --- the manacosts of the $i$-th spell.
Output the maximal total amount of mana $R$ such that the mage is unable to cast any spell.
If this number is infinitely large (for any total amount of mana $R,ドル there could be a situation so that the mage is unable to cast any spell), output "Infinity".
4 0 0 100 0 100 0 100 0 0 61 71 81
278
6 0 0 100 0 100 0 100 0 0 0 11 61 11 61 0 61 0 11
180
3 3 1 1 1 3 1 1 1 3
Infinity