This page is still under construction.

Parts of this page are still being built. What you see may change.

Drawing a Character Face

Time limit0.1sMemory limit256 MB

Summary
Given three circles, compute the area of their union, counting overlaps once, and print it to six decimal places.
Level

Hard8 of 10

Topics
Geometry, Math, Implementation, Brute force
Solved
No attempts yet

Problem

Many character faces can be drawn with three circles. When the face is one circle and the two ears sticking out at the sides are circles as well, laying three circles on top of each other already gives the rough outline of the face. The mouse character, the lion character, the tiger character and the bear character all work this way.

Silhouette of a character face drawn with three circles

You want the area of the figure drawn this way. Given the center and the radius of each of the three circles, write a program that computes the area of the region the three circles cover. Area where two circles overlap counts once.

Input

The input has three lines. Each line holds the integers xx, yy and rr, separated by spaces. They are the xx coordinate of the center, the yy coordinate of the center and the radius of the circle, in that order.

Every circle lies inside the square whose opposite corners are (0,0)(0, 0) and (100,100)(100, 100), so r≤x≤100−rr \le x \le 100 - r and r≤y≤100−rr \le y \le 100 - r. The radius is at least 11.

Two of the three circles can sit at the same place with the same radius, and one circle can lie completely inside another.

Output

Print the area of the region the three circles cover on one line, rounded to six digits after the decimal point. Always print all six digits.

Examples2

  1. Example 1

    Input
    10 10 5
    5 15 3
    15 15 3
    
    Expected output
    130.570546
    
  2. Example 2

    Input
    30 40 23
    70 40 23
    50 74 23
    
    Expected output
    4683.733435