Under construction

Still being built. Things may change

Meet at One Point!

Interview

Time limit1sMemory limit512 MB

Summary
Given triangle side lengths and two cevian foot offsets along two sides, find the third offset using Ceva's theorem for the concurrent cevians.
Level

Medium5 of 10

Topics
Geometry, Math
Solved
No attempts yet

Problem

Youngcheol likes geometric constructions. He especially likes constructions that use triangles. Youngcheol draws triangle ABC on paper and sets the length of side AB to c, side BC to a, and side CA to b. Then he marks one point inside triangle ABC and calls it P. He lets D be the intersection of the extension of segment AP with side BC, E the intersection of the extension of segment BP with side CA, and F the intersection of the extension of segment CP with side AB. That is, the three segments AD, BE, and CF meet at the single point P.

Given the values of a, b, c and the lengths of segments AF and BD, write a program that finds the length of segment CE.

Input

The first line gives the values of a, b, c in that order, separated by one space each. The second line gives the lengths of segments AF and BD in that order, separated by one space. All given values are positive integers, and it is guaranteed that no input makes the situation of the problem impossible.

Output

Print the length of segment CE on the first line. An absolute or relative error of up to 10-6 is allowed.

Constraints

  • 0 < a, b, c ≤ 100
  • 2×max(a, b, c) < a+b+c
  • (length of segment AF) < c
  • (length of segment BD) < a

Examples2

  1. Example 1

    Input
    8 4 6
    3 4
    Expected output
    2
  2. Example 2

    Input
    9 10 15
    13 8
    
    Expected output
    0.1886792452