Under construction

Still being built. Things may change

E(length(CH))

Time limit2sMemory limit256 MB

Summary
Given n points where each point is activated with probability p, find the expected perimeter of the convex hull of the activated points.
Level

Medium7 of 10

Topics
Probability, Geometry, Sorting
Solved
No attempts yet

Statement

You are given nn points on a plane. The ii-th point is activated with probability pip_i. Find the expected circumference of the convex hull of the activated points.

Input

The first line contains the number of points nn and the number p∗p^*. Every point is activated with probability pi=p∗p_i = p^*, except the first three, which are always activated (p1=p2=p3=1p_1 = p_2 = p_3 = 1). This way, the convex hull circumference is always defined. Each of the next nn lines contains the coordinates xix_i and yiy_i of the ii-th point, separated by a space.

Output

Print the expected circumference of the convex hull. Your answer is accepted if it differs from the reference solution by less than 0.0010.001.

Constraints

3≤n≤10003 \le n \le 1000; 0≤p∗≤10 \le p^* \le 1

0≤xi,yi≤10 0000 \le x_i, y_i \le 10\,000; xi,yi∈Zx_i, y_i \in \mathbb{Z}

No three points are collinear. No two points share an xx or yy coordinate.

Examples2

  1. Example 1

    Input
    4 0.281250
    6 6
    5 8
    8 3
    7 10
    
    Expected output
    12.816849
    
  2. Example 2

    Input
    5 0.561523
    2 11
    7 8
    13 10
    9 9
    13 3
    
    Expected output
    27.943471