410418: GYM104020 B Bellevue
Description
As any photographer knows, any good sunset photo has the sun setting over the sea. In fact, the more sea that is visible in the photo, the prettier it is!
You are currently visiting the island Bellevue, and you would like to take a photo of either the sunrise to the east or the sunset to the west to submit it to Bellevue's Astonishing Photography Competition. By carefully studying the topographic maps, you managed to find the east-west profile of the island. Now you would like to know the maximal amount of sea that you could capture in a photo, measured as the viewing angle covered by water.
The profile of the island is given as a piecewise linear function consisting of $$$n-1$$$ segments between $$$n$$$ points. The island starts and ends at sea level. As an example, Figure below shows the profile of the first sample case.
Note that the viewing angle of your lens is not large enough to capture the ocean to the east and west of the island in one shot. Also, the viewing angle of sea at sea level is $$$0$$$ degrees.
The input consists of:
- One line with an integer $$$n$$$ ($$$3\leq n\leq 50\,000$$$), the number of points.
- $$$n$$$ lines with two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i \leq 50\,000$$$), a point in the east-west profile of the island.
Output the maximal viewing angle of sea you can see, in degrees.
Your answer should have an absolute or relative error of at most $$$10^{-6}$$$.
ExamplesInput6 0 0 2 1 3 1 4 4 5 1 9 0Output
45.00000000000000000000Input
5 1 0 5 4 6 1 8 2 9 0Output
63.43494882292201064375