B. Presidential Election
time limit per test
5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Presidential election is coming up (November). In 2016, Clinton won the "majority" votes but Trump ended up with more "electoral" votes and won the race. (As a reminder, if a candidate receives more votes in a state, that candidate wins all the electoral votes for that state, i.e., electoral votes for a state are not divided proportionally based on the votes received by each candidate in that state.)

Election is in less than two months so let's predict the outcome! Given the voting data for each state, determine who wins the majority votes and who wins the electoral votes.

Input

The first input line contains an integer, $$$n$$$ $$$(1 ≤ n ≤ 50)$$$, indicating the number of states. Each of the next $$$n$$$ input lines contains three integers, providing voting data for a state: $$$e$$$ $$$(1 ≤ e ≤ 100)$$$, indicating electoral votes for the state, $$$v_1$$$ $$$(0 ≤ v_1 ≤ 1000)$$$, indicating votes for the first candidate, and $$$v_2$$$ $$$(0 ≤ v_2 ≤ 1000; v_2 ≠ v_1)$$$, indicating votes for the second candidate.

Output

Print $$$1$$$ (one) if the first candidate wins both the majority votes and the electoral votes. Print $$$2$$$ (two) if the second candidate wins both the majority votes and the electoral votes. Print $$$0$$$ (zero) for all the other cases. Assume that if the total majority votes for the two candidates tie, neither one wins the majority. Similarly, if the total electoral votes for the two candidates tie, neither one wins the electoral.

Examples
Input
3
5 10 50
15 30 60
10 25 15
Output
2
Input
3
5 48 50
15 57 60
10 25 15
Output
0