Lake Eleonora
The renowned band "Lake Eleonora" is planning a concert along a coordinate line.
In the country where the concert will take place, there are residents. The -th resident lives at coordinate , travels at a speed of one unit per seconds, and can hear the concert if it is held within units of their home.
The band needs to select an integer coordinate for the concert location. Residents who cannot hear the concert from their homes must travel to the concert site until they are within their hearing range (i.e., within units).
Your task is to help the band determine a location that minimizes the total travel time for all residents to reach a point where they can hear the concert. However, you should output the minimum possible total travel time, not the location itself.
Input
The first line contains a single integer ().
Each of the next lines contains three integers , , (, , ).
Output
Output a single integer — the minimum possible total travel time.
Examples
Scoring
( points): ;
( points): ;
( points): no additional constraints.