407881: GYM102916 E Powerless Mage
Description
A mage knows n spells, the i-th of which requires qi blue mana, wi purple mana and ei orange mana (qi + wi + ei > 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?
InputThe first line contains an integer n (1 ≤ n ≤ 200000) — the number of spells.
Each of the next n lines contains three integers qi, wi, ei (0 ≤ qi, wi, ei ≤ 109, qi + wi + ei > 0) — the manacosts of the i-th spell.
OutputOutput 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".
ExamplesInput4Output
0 0 100
0 100 0
100 0 0
61 71 81
278Input
6Output
0 0 100
0 100 0
100 0 0
0 11 61
11 61 0
61 0 11
180Input
3Output
3 1 1
1 3 1
1 1 3
Infinity