This content is archived!

For the 2018-2019 school year, we have switched to using the WLMOJ judge for all MCPT related content. This is an archive of our old website and will not be updated.


Recently, the moon passed closer to the Earth than it ever has in decades. Hazel, set on seizing the opportunity, stayed up all night to watch the moon through her circular window. Unfortunately, there’s no guarantee that the moon and Hazel’s window perfectly aligned, making it possible that Hazel only saw part of the moon. Can you figure out how much of the moon she saw?


Each test case begins with three integers X_w, Y_w, R_w (1 \leq X_w, Y_w, R_w \leq 1000), representing a circle centered at (X_w,Y_w) with radius R_w, the part of the sky that she could see through her window.

The next line contains three integers X_w, Y_w, R_w (1 \leq X_w, Y_w, R_w \leq 1000), the position and radius of the moon in the sky.


For each test case, output the area of the moon that was visible, rounded to two decimal places.

Sample Input 1

1 1 2
1 1 1

Sample Output 1


Sample Input 2

1 2 1
1 1 1

Sample Output 2



Read only if you are stuck or have already solved the problem.