아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Powerless Mage

시간 제한2초메모리 제한512 MB

요약
n개의 주문 마나 비용 벡터가 주어질 때, 어떤 주문도 시전할 수 없는 최대 총 마나 Q+W+E를 구하거나 무한히 큰 경우를 판정한다.
난이도

보통10점 중 7점

유형
수학, 기하, 구현
정답자
아직 제출이 없습니다

문제

A mage knows nn spells, the ii-th of which requires q_iq\_i blue mana, w_iw\_i purple mana and e_ie\_i orange mana (q_i+w_i+e_i>0q\_i + w\_i + e\_i > 0). Let's say the mage has QQ blue mana, WW purple mana and EE orange mana, and denote the total amount of mana Q+W+EQ + W + E as RR. Knowing that the mage is unable to cast any spell, what can be the maximal value of RR?

입력

The first line contains an integer nn (1≤n≤2000001 \le n \le 200000) --- the number of spells.

Each of the next nn lines contains three integers q_iq\_i, w_iw\_i, e_ie\_i (0≤q_i,w_i,e_i≤109,q_i+w_i+e_i>00 \le q\_i, w\_i, e\_i \le 10^{9}, q\_i + w\_i + e\_i > 0) --- the manacosts of the ii-th spell.

출력

Output the maximal total amount of mana RR such that the mage is unable to cast any spell.

If this number is infinitely large (for any total amount of mana RR, there could be a situation so that the mage is unable to cast any spell), output "Infinity".

예제3

  1. 예제 1

    입력
    4
    0 0 100
    0 100 0
    100 0 0
    61 71 81
    
    예상 출력
    278
    
  2. 예제 2

    입력
    6
    0 0 100
    0 100 0
    100 0 0
    0 11 61
    11 61 0
    61 0 11
    
    예상 출력
    180
    
  3. 예제 3

    입력
    3
    3 1 1
    1 3 1
    1 1 3
    
    예상 출력
    Infinity