Earth and Moon
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
It was the year 2047. Zenik and Marichka decided to go on a trip to Mars, provided by the world-famous tour operator \(U\ss\xi\mathbb{R}\). The view of the Earth and the Moon from space mesmerized Marichka, so she took a sheet of paper and decided to draw them. However, she was not much of an artist, so all she managed to draw was two circles: a blue one with center at \((x_1, y_1)\) and radius \(r_1\), which symbolized the Earth, and a yellow one with center at \((x_2, y_2)\) and radius \(r_2\), which symbolized the Moon.
As you know, a mixture of yellow and blue gives green. Therefore, the region belonging to both circles turned green. Zenik, who saw this artwork, became interested in two questions: how much this painting could be sold for on Mars, and what the area of the green color on the picture is.
Today you have to answer the second question.
Input
The first line contains three integers \(x_1, y_1, r_1\) — the parameters of the first circle.
The second line contains three integers \(x_2, y_2, r_2\) — the parameters of the second circle.
Output
In a single line, print a real number — the area of the intersection of the circles. The answer will be considered correct if its absolute or relative error does not exceed \(10^{-4}\).
Constraints
\(0 \le x_1, y_1, x_2, y_2 \le 10^3\),
\(1 \le r_1, r_2 \le 10^3\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 0 0 2 0 2 2 | 4.91347879 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|