Problem I. Inner rotation

Author:A. Baranov   Time limit:1 sec
Input file:input.txt   Memory limit:256 Mb
Output file:output.txt  


There are two triangles attached to a fixed point F. One triangle in fully inside of another. Each triangle is represented by vertices in polar coordinate system (varphi, r) with the origin at point F.

It is known that internal triangle may rotate around the fixed point until it touches the external triangle.

Your program must determine maximum range of possible rotation angles for internal triangle.

Input file format

Input file contains 6 floating point numbers representing vertices of external triangle: varphi1, r1, varphi2, r2, varphi3, r3.

Followed by 6 floating point numbers representing vertices of internal triangle in similar manner.

Output file format

Output file must contain the width of range of allowed rotation angles in radians, with at least 5 correct digits after decimal point.


All tests are designed to minimize errors due to machine loss of precision.

Both triangles are non-degenerate (vertices do not belong to the single line).

Fixed point F is inside of both triangles.

All angles varphii are in radians and in range from 0 to 2 ⋅ π.

Sample tests

No. Input file (input.txt) Output file (output.txt)
2.10630 2.00000
6.05701 2.00000
4.00000 2.00000

0.00000 0.50000
1.57080 0.50000
3.92699 0.50000
2.10630 1.23000
6.05701 1.50000
4.00000 2.00000

6.10430 0.40000
1.57080 0.40000
3.92699 1.60000

0.059s 0.009s 15