SQDIFF - Area Difference

A gardener bought two sprinklers for his new garden. Each sprinkler moistens the soil around a circle with known radius. One will be working in the morning and the other in the evening. To plan how many plants of different species is better to plant, the gardener wants to know what area of the garden will be watered only in the morning, only in the evening or both in the morning and in the evening. After some searching on the Internet, he found a formula for calculating the area of intersection of circles, but for some reason the formula that would help to calculate the remaining two areas was not found.

Input

The first line contains T (1 <= T <= 1000) - the number of tests. The next T lines contain six integers x1, y1, r1, x2, y2 and r2 (0 <= xi, yi, ri <= 10000) - coordinates and radii of the first and second sprinkler, respectively.

Output

For each test case print the absolute value of the difference between the the area that is going to be watered only in the moring and the area that is going to be watered only in the evening rounded to two decimals after the point. Your score is the source length.

Example

Input:
1
2 2 4 5 2 3

Output:
21.99


Added by:Spooky
Date:2010-03-09
Time limit:3s
Source limit:2000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi
Resource:Advancement Spring 2010, http://sevolymp.uuuq.com/, author: Alexey Shchepin

hide comments
2010-08-12 06:50:35 Piotr Fusik
How to round 1.006: 1, 1.00 or 1.01 ?

Last edit: 2010-08-12 06:51:15
2010-07-24 17:16:37 Piotr KÄ…kol
New record in this task in Perl: 59

Last edit: 2010-07-24 18:04:42
2010-06-07 17:26:27 numerix
Nice example!
2010-06-03 18:23:06 Piotr KÄ…kol
For example in this situation:
You should print absolute value of substraction of red and yellow areas.
2010-04-05 14:14:26 Srivatsan Iyer
What is the actual requirement ? Can you please elaborate? The question, though clear, lacks info as to what should be calculated ..
2010-04-02 14:25:31 Piotr KÄ…kol
This problem on main SPOJ
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.