266. Berlion

time limit per test: 0.25 sec.
memory limit per test: 65536 KB
input: standard
output: standard



Far far away in the galaxy there is a planet called Berlion. The legend says that the Precursors left rich heritage on the planet. There are a lot of galactic races competing to claim the heritage. By the will of mighty Precursors each civilization has only one chance to land on the planet and explore small area of the surface. Powerful guards left by Precursors keep competitors from violation of the will. No race can compete the guards in a combat.
Recently race of bertonoids has built two super-scanners to scan the surface for artifacts. Bertonoids set up scanners in two locations of the space, where the guards hopefully won't detect them. You can assume that the planet has the form of a sphere and the scanners are points.
You, as intern in Forecast Department, have to find the area of the surface the scanners can explore. The scanners can explore only the directly visible part of the surface (you can assume that there are no any other objects in the sector with Berlion and scanners).
So your task is to find the area of that part of the planet surface, from which at least one of the scanners is visible.

Input
The first line of the input file contains the integer number R -- the radius of the planet (1 <= R <= 10). The second line contains the coordinates of the first scanner relatively to the center of the planet -- 3 numbers -- the distances along the x, y and z axes of an ortogonal normalized coordinate system. The third line contains the coordinates of the second scanner in the same format. All coordinates are integers and do not exceed 100 by the absolute value. Both scanners are located at the distance not less than 10-2 above the planet surface.

Output
Output the visible area of the planet surface. The answer should be rounded to 3 decimal digits.

Sample test(s)

Input
Test #1

1
0 0 100
0 100 0

Test #2

1
0 0 100
0 0 -100

Output
Test #1

9.362

Test #2

12.441
[submit]
[forum]

Author:Ilya V. Elterman
Resource:ACM ICPC 2004-2005, NEERC, Southern Subregional Contest
Date:Saratov, October 7, 2004











Server time: 2017-09-25 22:31:35Online Contester Team © 2002 - 2016. All rights reserved.