Back

Overlapping Circles

Worth 10 point(s) - Runtime Limit: 2 seconds

Introduction

Let’s say that we have 2 circles in 2D space, as shown below:

Given the coordinates of centers of the circle and the length of the radii, find the area of the region that is covered by one or both circles.

Input:
The first line contains an integer D, the number of test cases. The following D lines each contain 6 positive integers: x1, y1, x2, y2, r1, and r2, respectively.

Output:
For each test case, output a line containing the area of the region described above to the nearest thousandth.

Sample Input

2
0 0 5 5 10 10
31 67 50 20 50 50

Sample Output

452.576
12697.102