Wesley's Anger Contest 2 Problem 4 - The Ninth Triangle of the Underworld

View as PDF

Submit solution


Points: 20
Time limit: 0.5s
Java 2.0s
Python 2.0s
Memory limit: 256M

Authors:
Problem types

At your neighbourhood Halloween party, appropriately named The Ninth Triangle of the Underworld, you've decided to play a fun game! Two witch hats are placed on conveyor belts moving in opposite directions. For simplicity, we can imagine the witch hats as triangles, with their bases on the same line parallel to the x-axis, and that the witch hats will continue moving in opposite directions for eternity.

You are asked to throw a ball at the witch hats and will win a prize if you hit either one of them. To make your life more difficult, you will only be told the side lengths of the triangles and will not be told the orientation of the witch hats. In addition, you will not be told when to throw the ball at the targets.

You want to know what is the smallest target area you could possibly be facing when you throw the ball. The target area is the area of the union of the two triangles at their current locations.

Constraints

1 \le a, b, c, d, e, f \le 10^8
a, b, c, d, e, f \in \mathbb{Z}
a < b + c
b < a + c
c < a + b
d < e + f
e < d + f
f < d + e

Input Specification

The first line of input contains 3 integers, a, b, c, the side lengths of the first triangle representing the first witch hat.

The second line of input contains 3 integers, d, e, f, the side lengths of the second triangle representing the second witch hat.

Output Specification

This problem is graded with an custom checker.

Output, on a single line, the smallest target area you could possibly be facing when you throw the ball at the witch hats. Ensure this line is terminated with a \n character and has no leading nor trailing spaces.

Your answer will be considered correct if it has an absolute or relative error of at most 10^{-8} from the reference solution. It is guaranteed that the absolute or relative error of the reference solution is much smaller than 10^{-8} from the optimal solution.

Sample Input

8 5 5
6 6 6

Sample Output

16.9112382237

Comments

There are no comments at the moment.