cho.sh
Notes
Loading...

Parallelogram

Time limit

2s

Memory limit

128 MB

Problem

A parallelogram is a quadrilateral whose two pairs of opposite sides are parallel. Three distinct points A(x_A, y_A), B(x_B, y_B), and C(x_C, y_C) are given.

Choose a point D, if possible, so that the four points form a parallelogram. There may be more than one possible point D.

Among all parallelograms that can be formed, output the difference between the largest perimeter and the smallest perimeter. If no parallelogram can be formed, output -1.

Input

The first line contains six integers x_A y_A x_B y_B x_C y_C. The absolute value of each coordinate is at most 5000.

Output

Print the answer on the first line. An absolute or relative error of at most 10^-9 is accepted.