eolymp
bolt
Try our new interface for solving problems
Problems

Fence Orthogonality

Fence Orthogonality

Evil bunnies are eating Freddy's vegetables. In order to stop them, he decided to build a fence enclosing all vegetables in his garden. Freddy wants the fence to be as cheap (i.e. short) as possible, but for technical reasons, he can only build rectangular fences. For simplicity, we will assume the vegetables are negligibly small and can be represented by points in a two-dimensional plane.

Input

Consists of several test cases. The first line of each test case contains one integer n (3n10000) giving the number of vegetables in the garden. Each of the following n lines contains two integers xi and yi (0xi, yi10000), giving the coordinates of one vegetable to be protected. No two vegetables have the same coordinates. You may also assume the vegetables are not all on the same straight line.

Output

For each test case, output a single line containing one real number t, giving the smallest length of the perimeter of a rectangular fence enclosing all the vegetables. Note that the edges of the rectangle do not need to be parallel with the coordinate axes. The answer will be accepted as correct if the difference between t and the exact answer is at most 0.0005.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3
0 0
1 0
0 1
3
10 0
0 10
4 4
4
1 0
0 1
2 1
1 2
Output example #1
4
31.112698
5.656854
Source 2013 ACM ICPC Czech Technical University (CTU) Open Contest, Prague, Problem D