#D12835. Making Perimeter of the Convex Hull Shortest

    ID: 10671 Type: Default 10000ms 268MiB

Making Perimeter of the Convex Hull Shortest

Making Perimeter of the Convex Hull Shortest

Problem D Making Perimeter of the Convex Hull Shortest

The convex hull of a set of three or more planar points is, when not all of them are on one line, the convex polygon with the smallest area that has all the points of the set on its boundary or in its inside. Your task is, given positions of the points of a set, to find how much shorter the perimeter of the convex hull can be made by excluding two points from the set.

The figures below correspond to the three cases given as Sample Input 1 to 3. Encircled points are excluded to make the shortest convex hull depicted as thick dashed lines.

Sample Input 1 Sample Input 2 Sample Input 3

Input

The input consists of a single test case in the following format.

nn x1x_1 y1y_1 ... xnx_n yny_n

Here, nn is the number of points in the set satisfying 5n1055 \leq n \leq 10^5. For each ii, (xi,yix_i, y_i) gives the coordinates of the position of the ii-th point in the set. xix_i and yiy_i are integers between 106-10^6 and 10610^6, inclusive. All the points in the set are distinct, that is, xjxkx_j \ne x_k or yjyky_j \ne y_k holds when jkj \ne k. It is guaranteed that no single line goes through n2n - 2 or more points in the set.

Output

Output the difference of the perimeter of the convex hull of the original set and the shortest of the perimeters of the convex hulls of the subsets with two points excluded from the original set. The output should not have an error greater than 10410^{-4}.

Sample Input 1

10 -53 62 -19 58 -11 11 -9 -22 45 -7 37 -39 47 -58 -2 41 -37 10 13 42

Sample Output 1

72.96316928

Sample Input 2

10 -53 62 -19 58 -11 11 -9 -22 45 -7 43 -47 47 -58 -2 41 -37 10 13 42

Sample Output 2

62.62947992

Sample Input 3

10 -53 62 -35 47 -11 11 -9 -22 45 -7 43 -47 47 -58 -2 41 -37 10 13 42

Sample Output 3

61.58166534

Example

Input

10 -53 62 -19 58 -11 11 -9 -22 45 -7 37 -39 47 -58 -2 41 -37 10 13 42

Output

72.96316928

inputFormat

Input 1 to 3. Encircled points are excluded to make the shortest convex hull depicted as thick dashed lines.

Sample Input 1 Sample Input 2 Sample Input 3

Input

The input consists of a single test case in the following format.

nn x1x_1 y1y_1 ... xnx_n yny_n

Here, nn is the number of points in the set satisfying 5n1055 \leq n \leq 10^5. For each ii, (xi,yix_i, y_i) gives the coordinates of the position of the ii-th point in the set. xix_i and yiy_i are integers between 106-10^6 and 10610^6, inclusive. All the points in the set are distinct, that is, xjxkx_j \ne x_k or yjyky_j \ne y_k holds when jkj \ne k. It is guaranteed that no single line goes through n2n - 2 or more points in the set.

outputFormat

Output

Output the difference of the perimeter of the convex hull of the original set and the shortest of the perimeters of the convex hulls of the subsets with two points excluded from the original set. The output should not have an error greater than 10410^{-4}.

Sample Input 1

10 -53 62 -19 58 -11 11 -9 -22 45 -7 37 -39 47 -58 -2 41 -37 10 13 42

Sample Output 1

72.96316928

Sample Input 2

10 -53 62 -19 58 -11 11 -9 -22 45 -7 43 -47 47 -58 -2 41 -37 10 13 42

Sample Output 2

62.62947992

Sample Input 3

10 -53 62 -35 47 -11 11 -9 -22 45 -7 43 -47 47 -58 -2 41 -37 10 13 42

Sample Output 3

61.58166534

Example

Input

10 -53 62 -19 58 -11 11 -9 -22 45 -7 37 -39 47 -58 -2 41 -37 10 13 42

Output

72.96316928

样例

10
-53 62
-19 58
-11 11
-9 -22
45 -7
37 -39
47 -58
-2 41
-37 10
13 42
72.96316928