#P1756. Emphasizing Highlighted Regions

    ID: 15041 Type: Default 1000ms 256MiB

Emphasizing Highlighted Regions

Emphasizing Highlighted Regions

Little Z is an outstanding mathematician who loves exploring small mathematical problems. One day, he selected n points on a piece of paper and connected every pair of these points with a pencil, forming \(\dfrac{n(n-1)}{2}\) segments. Looking at these segments, he decided that some of them were particularly important and needed to be emphasized.

To emphasize a segment, Little Z uses a brush which, when applied on the paper, produces a circle of radius \(r\) at the brush’s center. When drawing along a segment, the brush’s center starts at one endpoint and moves continuously to the other endpoint, thereby "thickening" the segment. In other words, the highlighted region corresponding to a segment is the Minkowski sum of the segment and a disk of radius \(r\), whose area equals \(2rL + \pi r^2\) for a segment of length \(L\).

It can be shown that when all segments (i.e. every segment connecting two chosen points) are emphasized in this way, the union of these thickened segments is exactly the Minkowski sum of the convex hull of the points and a disk of radius \(r\). Consequently, the total emphasized area is given by:

\(\text{Area} = A + r \cdot P + \pi r^2\),

where \(A\) is the area of the convex hull of the points and \(P\) is its perimeter.

Your task is to compute the emphasized area based on the given points and the brush radius \(r\).

inputFormat

The first line contains two numbers: n (the number of points) and r (the brush radius). Each of the following n lines contains two real numbers representing the coordinates of a point.

outputFormat

Output a single real number representing the emphasized area. The answer is accepted if its absolute or relative error does not exceed \(10^{-6}\).

sample

3 1
0 0
1 0
0 1
6.0568062161