Square Pasture#10556

Square Pasture

1 second
128 megabytes
Very easy

Farmer John has decided to update his farm to simplify its layout. Previously, his cows grazed in two rectangular fenced-in pastures. Farmer John would like to replace them with a single square fenced-in pasture of minimum size that still covers all the areas of his farm that were previously enclosed by the two fences.

Please help Farmer John determine the minimum area of the new square pasture. The square must have its sides parallel to the - and -axes and must be positioned so that it covers all the area previously contained in the two rectangular pastures.

Input

The first line contains four integers x_1, y_1, x_2, y_2~(0 \le x_1 < x_2 \le 10, 0 \le y_1 < y_2 \le 10), describing one of the original rectangular pastures. Its lower-left corner is at (x_1, y_1), and its upper-right corner is at (x_2, y_2).

The second line contains four integers x_1, y_1, x_2, y_2 in the same format, describing the second rectangular pasture. The two pastures do not overlap or touch.

Output

Print one integer: the minimum area of a square pasture whose sides are parallel to the axes, and which covers all the areas originally contained in the two rectangular pastures.

Examples

In the example, the first rectangle has corners and , while the second has corners and . A square with side length and corners and can enclose both original pastures.

This is optimal because it is impossible to enclose both pastures with a square of side length . Note that there are several valid placements for the square of side length , since it can be shifted vertically while still enclosing both pastures.

Example 1

Loading
Loading