#KONSTRAKSCHION. Weird Construction
Weird Construction
Vieri Corp, a technology company, has requested Bima, a constructor, to build an isosceles triangle on their brand new field. On each vertex of the triangle, they requested a pole A, B and C where AB = BC. It is guaranteed that B is the shortest pole. They also requested a rope of length x and y to connect the tip of the poles AB and BC respectively. Given the height of pole A, C and the length of rope x and y help Bima calculate the the height of pole B. You should minimize B. I've decreased the constraints so don't worry about precision error :) It is guaranteed that there will be an answer. The ropes cannot be loose. The pole's diameter is negligible.
Refer to the image below for better understanding.
Input
A C x y
Output
The height of pole B correct to 3 decimal places.
Examples
Input 1: 10 20 10 18.973665961</p>Output 1: 2.000000
Input 2: 10 7 8.5 6.0207972894 Output 2: 2.500
Constraints
- 1 ≤ A ≤ 500000
- 1 ≤ C ≤ 500000
- 1 ≤ x ≤ 500000
- 1 ≤ y ≤ 500000