City Horizon
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Farmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildings.
The entire horizon is represented by a number line with buildings. Building 's silhouette has a base that spans locations through along the horizon and has height . Determine the area, in square units, of the aggregate silhouette formed by all buildings.
Input
The first line contains a single integer . Each of the next lines describes building with three integers: and .
Output
Print the total area, in square units, of the silhouettes formed by all buildings.
Examples
Input #1
Answer #1
Submissions 542
Acceptance rate 51%