# SEERC 2021

# Simple Hull

Gary has been trying to generate simple orthogonal polygons for his geometry homework, but his algorithm seems to be having some issues. After some good hours of debugging, he finally realized what is the problem: apparently, the polygons that he was generating may contain self-intersections, which was not at all what he intended!

More specifically, the “polygons” that Gary has generated are represented by a list of **n** points `p`

= (_{i}`x`

, _{i}`y`

), forming a closed polygonal chain. The polygonal chain may contain self-intersections. The segments formed by every two consecutive points (_{i}`x`

, _{i}`y`

) and (_{i}`x`

, _{j}`y`

) in the chain are either vertical or horizontal._{j}

The polygonal chains for the example test cases are illustrated below (not to scale):

You have decided to help Gary fix this issue, by computing a simple (not self-intersecting) polygon with vertical and horizontal segments that fully contains the chain, and its area is as small as possible. What is the area of such a polygon?

Formally, you have to compute the infimum of the areas of all simple orthogonal polygons that contain all the segments [`p`

, _{i}`p`

], for every two adjacent points _{j}`p`

and _{i}`p`

._{j}

#### Input

The first line will contain a positive integer **n** (**4** ≤ **n** ≤ **100 000**). The following **n** lines will contain the points (`x`

, _{i}`y`

) in order (_{i}**1** ≤ `x`

, _{i}`y`

≤ _{i}`10`

). No two consecutive points coincide, and there are no two consecutive vertical segments or two consecutive horizontal segments.^{6}

#### Output

Output a single non-negative integer, the infimum of the areas of all simple polygons that enclose the closed polygonal chain. It can be proven that the answer is always integer.

#### Example

In examples **1** and **3** there are no simple polygons with areas exactly equal to **50** and **8**, respecively; however, there exist simple polygons with areas arbitrarily close to these values.

6 1 1 6 1 6 11 11 11 11 6 1 6

50

8 2 4 2 1 4 1 4 3 1 3 1 2 3 2 3 4

6

10 1 1 1 5 4 5 4 3 2 3 2 4 1 4 1 2 4 2 4 1

8