import [Link].
*;
import [Link].*;
class Main {
static class Point implements Comparable<Point> {
int x, y;
Point(int x, int y) { this.x = x; this.y = y; }
public int compareTo(Point p) {
if (this.x != p.x) return this.x - p.x;
return this.y - p.y;
// Cross product to check turn direction
static long cross(Point o, Point a, Point b) {
return (long)(a.x - o.x) * (b.y - o.y) - (long)(a.y - o.y) * (b.x - o.x);
// Distance between two points
static double dist(Point a, Point b) {
return [Link]((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
int N = [Link]();
Point[] points = new Point[N];
for (int i = 0; i < N; i++) {
points[i] = new Point([Link](), [Link]());
[Link](points);
// Build lower hull
List<Point> lower = new ArrayList<>();
for (Point p : points) {
while ([Link]() >= 2 && cross([Link]([Link]()-2),
[Link]([Link]()-1), p) <= 0) {
[Link]([Link]()-1);
[Link](p);
// Perimeter calculation for lower hull
double perimeter = 0;
for (int i = 0; i < [Link]() - 1; i++) {
perimeter += dist([Link](i), [Link](i+1));
[Link]([Link](perimeter));