Time limit
2s
Memory limit
128 MB
N vertical pillars stand in a row. Every pillar has width 1 m, and their heights may be different. A tin warehouse must be built so that it contains all pillars.
The roof of the warehouse must satisfy the following conditions.
Viewed from the side, the polygon enclosed by the roof and the ground is called the warehouse polygon. Given the positions and heights of the pillars, find the minimum possible area of the warehouse polygon.
The first line contains an integer N, the number of pillars. N is between 1 and 1,000, inclusive.
Each of the next N lines contains two integers L and H, separated by a space. L is the position of the left side of the pillar, and H is its height. Both L and H are between 1 and 1,000, inclusive.
Print one integer: the minimum area of the warehouse polygon.