P10251 Farm.

Background

Join mc2b2t.com, thanks meow. upd: ![](https://cdn.luogu.com.cn/upload/image_hosting/ks73gdzb.png)

Description

ZHY wants to manage his farm. Specifically, he has $n$ farm plots. Each plot is a rectangle whose four sides are all parallel to the coordinate axes. These plots may overlap. Now he wants to fence off a piece of land to maintain his farm. He wants this land to completely cover all farm plots. For convenience, he also wants this land to be a rectangle whose four sides are parallel to the coordinate axes. He wants to minimize the area of this rectangle. Because he has too many farm plots, he asks you for help. You need to output the area of this rectangle.

Input Format

The first line contains a positive integer $n$. In the next $n$ lines, four integers $x_{1}, y_{1}, x_{2}, y_{2}$ are given, meaning there is a farm plot whose two diagonal vertices are $(x_{1}, y_{1})$ and $(x_{2}, y_{2})$.

Output Format

Output one integer, the minimum area of the fenced land.

Explanation/Hint

Sample explanation: as shown in the figure below, green is the first farm plot and red is the second. It is easy to see that the minimum fenced area is $3 \times 4 = 12$. ![](https://cdn.luogu.com.cn/upload/image_hosting/8hhhluee.png) ---- Constraints: For $40\%$ of the testdata, $n, |x|, |y| \le 200$. For $100\%$ of the testdata, $1 \le n \le 2 \times 10^{5}$, $0 \le |x|, |y| \le 10^{9}$, $x_{1} \neq x_{2}$, $y_{1} \neq y_{2}$. Translated by ChatGPT 5