Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 3058
Circle and Ring

Time Limit: 1 Second      Memory Limit: 32768 KB

Given a circle and a ring, your task is to calculate the area of their intersection.

Input

This problem contains multiple test cases, process to the end of file.

For each case, there are two lines. The first line contains three real numbers x', y' and r' (0 <= r' <= 1024) representing the circle. The second line contains four real numbers x, y, r and R (0 <= r <= R <= 1024) representing the ring.

Output

For each case, output the area with the accuracy of three digits after decimal point in a signal line.

Never output "-0.000"!

Sample Input

10 0 20
-10 0 10 20
20 30 15
40 30 0 30

Sample Output

351.041
608.366

Author: WU, Zejun
Source: ZOJ Monthly, November 2008
Submit    Status