beecrowd | 2517

PoGro Challenge

By Ricardo Oliveira, UFPR BR Brazil

Timelimit: 1

PoGro is a famous brand of hi-tech digital cameras. This year, PoGro is promoting the PoGro Challenge! In this challenge, each participant must jump from the top of a building and land safely at a specific point in the ground, using only an hang-glider.

Consider that the top of the building is at the point (0,C) of the Cartesian plane, and the landing point is at (xF, 0). In order to complete the challenge, the participant must follow strictly the path defined by the parabola given by the function f(x) = -x²/A - x/B + C, where A, B and C are values chosen by the staff such that f(xF) = 0. The path is presented in the following figure:

The staff put a PoGro camera at the position (xc, yc) of the plane, which will be used to take a photo of the participant. To make the photo as good as possible, the photo will be taken in the exact moment the participant is closest to the camera.

However, the staff is having trouble to determine what will be the distance between the camera and the participant in the moment the photo will be taken (exemplified by the dotted line in the figure). Given the path of the participant and the camera’s position, determine the distance between both of them in the moment the photo will be taken!

Input

First line of each test case contains three integers A, B, C (1 ≤ A, B, C ≤ 200) describing the path. Second line contains two integers xc and yc (0 ≤ xc, yc ≤ 200) indicating the camera’s position. Third and last line of each test case contains the integer xF (1 ≤ xF ≤ 200) indicating the landing point.

It is guaranteed that f(xF) = 0. Also, please notice that f(x) is such that the function is decreasing for x ≥ 0, and that the height of the building is positive.

The input ends with end-of-file (EOF).

Output

For each test case, print a line containing the distance between the camera and the participant in the moment the photo is taken. Round and print the answer with exactly 2 decimal places.

Input Sample Output Sample

10 2 5
2 2
5

1.14