Under construction

Still being built. Things may change

Crime Scene

Interview

Time limit2sMemory limit1024 MB

Summary
Given a convex polygon with some fence sides missing, find the minimum total length of missing sides that a tape of length l walked along the boundary cannot cover.
Level

Medium5 of 10

Topics
Sliding window, Two pointers, Prefix sum, Geometry
Solved
No attempts yet

Statement

Inspector Lestrade is not a gifted deducer, but he has mastered every detail of routine police work. Oddly, many standard procedures can hide a mystery as worthy of attention as the crime itself.

One evening the inspector arrived at the crime scene, a fenced vacant lot. The lot is a convex polygon with posts standing at its vertices. Apparently, there used to be a fence section between every two posts at adjacent vertices. Time has passed, however, and some fence sections have vanished without a trace. The inspector noticed that every missing section still has its neighboring sections standing.

Lestrade then set about closing off the scene with police tape. He discovered a serious problem: he has only ll meters of tape left. The inspector does not want to cut the tape into pieces, and the tape must lie only along the perimeter of the lot. He will fix one end of the tape at a point on the boundary, walk ll meters along the boundary in one of two directions, and fix the other end at the point where he stops. Every part of the boundary he walked past is covered by tape, and every other part is not.

Lestrade wants to know the minimum total length of the boundary with no fence that he cannot cover with tape. Help him, because Sherlock Holmes will arrive soon.

Input

The first line contains three integers nn, ll, and kk (3≤n≤1053 \le n \le 10^5, 0≤l≤10180 \le l \le 10^{18}, 0≤k≤n20 \le k \le \frac{n}{2}): the number of polygon vertices, the length of the tape, and the number of missing fence sections. The second line contains kk integers aia_i (1≤ai≤n1 \le a_i \le n, ai<ai+1a_i < a_{i+1}). Each aia_i means the side between vertices aia_i and ai mod n+1a_i \bmod n + 1 has no fence. No two consecutive sides are missing. The next nn lines each contain integers xix_i and yiy_i (∣xi∣≤1018|x_i| \le 10^{18}, ∣yi∣≤1018|y_i| \le 10^{18}), the coordinates of the ii-th vertex. The vertices are given in order around the polygon in one of the two traversal directions.

Output

Print one real number: the minimum total length of the missing fence sections that the tape cannot cover. The answer is accepted if it differs from the correct value by at most p×10−6p \times 10^{-6}, where pp is the perimeter of the polygon.

Examples1

  1. Example 1

    Input
    6 4 3
    1 3 5
    0 0
    3 0
    4 1
    3 2
    0 2
    -1 1
    
    Expected output
    2.8284271