Two Circles

Time limit1sMemory limit128 MB

Summary
Compute the area of the overlapping region of two circles from their centers and radii, printing the result to three decimals.
Level

Medium4 of 10

Topics
Geometry, Math, Implementation
Solved
No attempts yet

Problem

Two circles are given on a 2D plane. Write a program that computes the area of the region where the two circles overlap (their intersection), accurate to three decimal places.

Input

The first line contains six real numbers x1x_1, y1y_1, r1r_1, x2x_2, y2y_2, r2r_2, separated by spaces. (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) are the centers of the first and second circle, and r1r_1 and r2r_2 are their radii. Each real number is given with at most two digits after the decimal point.

Output

On the first line, print the area of the overlapping region, rounded to three decimal places. If the two circles do not overlap, print 0.0000.000.

Examples1

  1. Example 1

    Input
    20.0 30.0 15.0 40.0 30.0 30.0
    
    Expected output
    608.366