SQDIFF - Area Difference

no tags 

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


hide comments
XeRoN!X: 2015-01-20 07:19:46

@Author, kindly rejudge all Perl solutions submitted before compiler upgradation to 5.12.1

vengadesh.v: 2015-01-20 07:19:46

what are mean by...x,y

.::Manish Kumar::.: 2015-01-20 07:19:46

ya...i got ac with 1.50

Last edit: 2010-06-27 14:23:15
.::Manish Kumar::.: 2015-01-20 07:19:46

it appears
option a:1.50
is correct

Last edit: 2010-06-27 13:55:39
.::Manish Kumar::.: 2015-01-20 07:19:46

how should i round 1.5?
option a:1.50
option b:1.5

numerix: 2015-01-20 07:19:46

rounding: as usual
pi: 3.141592653589793238462643383279
output: read the description above

Tarun Chauhan: 2015-01-20 07:19:46

what are the rules of rounding? and whats the value of pi? and whats the output format?


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