Problems
Thousands of planets outside the Solar System have been discovered in recent years. An important factor for potential life support is the availability of liquid water. Detecting water on faraway planets is not easy. For rotating planets, a brand-new technology using relativistic quantum-polarized spectroscopy can help. It works as follows (this is a simplified description as only three people on this planet understand how it really works).
Assume the telescope shows the planet such that its rotating axis is vertical and its equator is horizontal. Only the vertical line at the center of the image (the line that covers the rotating axis) is analyzed, because it provides the highest resolution of the planet’s surface.
The analysis proceeds in steps of
You may assume the planet’s surface is a sphere. This means each area
The above process is repeated for the next
Input
The first line of input contains the two integers
Output
Output the percentage of the planet’s surface covered by water. Your answer should have an absolute error of at most
Example #1
3 7
63 61 55 54 77 87 89
73 60 38 5 16 56 91
75 43 11 3 16 20 95
51.809523810
Example #2
4 3
10 10 10
10 10 10
10 10 10
10 10 10
10.000000000