Jamshid Kazemi (who is known by the pseudonym Kamran Pouriai), has recently become a man and was released from prison. Having been in prison for a long time, he has moved away from the programming and computer space and wants to return to this space by participating in programming competitions. That's why he came to Quera site and browsed between the competitions held. In the meantime, the Snapp Challenge caught his attention. Here's how the quiz (like the one you're currently participating in!) was ranked: Contestants are ranked by the number of questions they complete. People who solve the same number of questions are arranged in the order of their penalty; It means that whoever has a lower fine will get a better rank. The amount of the fine is calculated as follows:

Assume that the participant's total final submission time for the questions he solved
a
a be seconds, and for those questions in total
b
b sent the wrong time (before the final send). (For example, a submission that gives a wrong answer, or a submission that does not have an appropriate execution time.) In this case, the penalty of the participant is equal to
a
+
1200
x
b
a+1200xb will be. That is, every wrong sending is like 1200 seconds (equal to 20 minutes) late in sending the final reply.

Finally, people who have solved the same number of questions and have the same penalty will get equal rank. For example, if 2 people rank 5, the next person will rank 7 and the match will not rank 6. And if 4 people get rank 3, the next person will get rank 7 and there will be no 4th, 5th and 6th rank match.

This way of ranking and especially the 20 minute penalty for each wrong submission made Jamshid wonder if this is the best way to rank? Therefore, he thought of changing this 20-minute time. It is clear that the logical value of this number may be any decimal value; So, to choose the right value, a special analysis should be done. He does this analysis like this: Suppose a participant's rank in the ranking, assuming a 20-minute penalty,
r
r is Now suppose that the amount of the penalty for each wrong submission changes, and in the ranking that takes place assuming the new value, the rank of this participant is equal to
r
′
r
′
 to be If the participant's rank was better in this case (or
r
>
r
′
r>r
′
 ), participant in amount
(
r
-
r
′
)
2
(r−r
′
 )
2
 He will be happy and if the rank had worsened, to the amount
(
r
′
-
r
)
2
(r
′
 (r)
2
 It is sad that it is like this
-
(
r
′
-
r
)
2
−(r
′
 (r)
2
 He is happy. Now, the total happiness level of all the participants in this rating is the good value
r
′
r
′
 We consider it for the rating penalty.

Jamshid, who has now become a good and kind-hearted person, wants to measure the ratings based on the criteria that are determined by the happiness of the people. Therefore, it seeks the maximum amount of goodness for all possible fine amounts. (All positive or negative integer or decimal values ​​can be selected for penalty!) By getting the values
a
a and
b
b and the number of questions solved for each participant of a competition, calculate the highest possible degree of goodness for ranking this competition.

In fact, such an analysis was carried out in relation to the optimal ranking in Quora to change the penalty amount if needed!

input
In the first line, enter a number
n
n stands for the number of participants in the competition. Then in each of
n
n the next line comes three numbers, which for a participant in the order of the number of questions solved, value
a
a (total time of final submissions for solved questions in seconds) and value
b
b (the number of wrong submissions for solved questions).

The number of questions solved by each person is a natural number and a maximum of 7.
1
≤
n
≤
100
1≤n≤100
0
≤
a
≤
86

400
0≤a≤86 400
0
≤
b
≤
70
0≤b≤70

output
On the only output line, print a number that is equal to the maximum goodness-of-fit of all the different values ​​for the penalty.

Example
Sample entry 1
4
1 100 10
1 100 30
1 100 50
1 100 70
Plain text
Sample output 1
14
Plain text
Sample entry 2
4
1 30 2
1 60 1
2 70 1
2 90 3
Plain text
Sample output 2
1              this is hard write complex python code