408166: GYM103036 B Vinyl Records

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Vinyl Recordstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Arturo realized that he doesn't listen to his vinyl records very often anymore so he decides to hang them up on the wall of his study. He grabs one of his vinyl records which consists of $$$n$$$ concentric circles (circles are concentric if they all share the same center) and decides to paint over the top of the vinyl record to fit the decor of his room. He starts at the outermost ring of the vinyl (a ring is defined as the space between two concentric circles that lie within the circle of a bigger radius and outside the circle with the smaller radius) and paints it red. He then paints the outermost unpainted ring blue and continues this process of alternating colors for each of the rings, each time choosing the outermost one that has not been painted yet.

Given the radii (in centimeters) of the $$$n$$$ concentric circles for a particular vinyl, help Arturo figure out the area (in $$$\text{cm}^{2}$$$) of the vinyl that gets painted red.

Input

The first line contains a single integer $$$n$$$ where $$$1 \leq n \leq 100$$$ and $$$n$$$ represents the number of concentric circles in the vinyl record.

The second line of input contains $$$n$$$ space-separated integers $$$r_1, \dots, r_n$$$ where $$$1 \leq r_i \leq 1000$$$ for all integers $$$1 \leq i \leq n$$$ representing the radii (in centimeters) of each of the concentric circles. It is guaranteed that $$$r_i \neq r_j$$$ for all $$$i \neq j$$$.

Output

Output the total area (in $$$\text{cm}^2$$$) of the vinyl record that will be painted red. Your answer will be accepted if the absolute or relative error does not exceed $$$10^{-6}$$$.

ExamplesInput
2
2 1
Output
9.42477796076938
Input
4
4 1 3 2
Output
31.4159265358979
Note

In the first example the overall radius of the vinyl is $$$(2 \cdot \pi)^2$$$ and the inner circle of radius $$$1$$$ will be painted blue so the radius printed red is $$$(2 \cdot \pi)^2 - (\pi)^2 = 3 \cdot (\pi)^2 \approx 9.424$$$.

加入题单

算法标签: