3643: CF248 - C. Robo-Footballer
[Creator : ]
Description
It's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advantages over the other guys.
For example, he can hit the ball directly to the specified point. And yet, the notion of a giveaway is foreign to him. The combination of these features makes the Robo-Wallace the perfect footballer − as soon as the ball gets to him, he can just aim and hit the goal. He followed this tactics in the first half of the match, but he hit the goal rarely. The opposing team has a very good goalkeeper who catches most of the balls that fly directly into the goal. But Robo-Wallace is a quick thinker, he realized that he can cheat the goalkeeper. After all, they are playing in a football box with solid walls. Robo-Wallace can kick the ball to the other side, then the goalkeeper will not try to catch the ball. Then, if the ball bounces off the wall and flies into the goal, the goal will at last be scored.
Your task is to help Robo-Wallace to detect a spot on the wall of the football box, to which the robot should kick the ball, so that the ball bounces once and only once off this wall and goes straight to the goal. In the first half of the match Robo-Wallace got a ball in the head and was severely hit. As a result, some of the schemes have been damaged. Because of the damage, Robo-Wallace can only aim to his right wall (Robo-Wallace is standing with his face to the opposing team's goal).
The football box is rectangular. Let's introduce a two-dimensional coordinate system so that point (0,0) lies in the lower left corner of the field, if you look at the box above. Robo-Wallace is playing for the team, whose goal is to the right. It is an improvised football field, so the gate of Robo-Wallace's rivals may be not in the middle of the left wall.
In the given coordinate system you are given:
ject, if the distance from the center of the ball to the object is no greater than the ball radiusr.
For example, he can hit the ball directly to the specified point. And yet, the notion of a giveaway is foreign to him. The combination of these features makes the Robo-Wallace the perfect footballer − as soon as the ball gets to him, he can just aim and hit the goal. He followed this tactics in the first half of the match, but he hit the goal rarely. The opposing team has a very good goalkeeper who catches most of the balls that fly directly into the goal. But Robo-Wallace is a quick thinker, he realized that he can cheat the goalkeeper. After all, they are playing in a football box with solid walls. Robo-Wallace can kick the ball to the other side, then the goalkeeper will not try to catch the ball. Then, if the ball bounces off the wall and flies into the goal, the goal will at last be scored.
Your task is to help Robo-Wallace to detect a spot on the wall of the football box, to which the robot should kick the ball, so that the ball bounces once and only once off this wall and goes straight to the goal. In the first half of the match Robo-Wallace got a ball in the head and was severely hit. As a result, some of the schemes have been damaged. Because of the damage, Robo-Wallace can only aim to his right wall (Robo-Wallace is standing with his face to the opposing team's goal).
The football box is rectangular. Let's introduce a two-dimensional coordinate system so that point (0,0) lies in the lower left corner of the field, if you look at the box above. Robo-Wallace is playing for the team, whose goal is to the right. It is an improvised football field, so the gate of Robo-Wallace's rivals may be not in the middle of the left wall.
In the given coordinate system you are given:
- $y_1,y_2$− they-coordinates of the side pillars of the goalposts of robo-Wallace's opponents;
- $y_w$− they-coordinate of the wall to which Robo-Wallace is aiming;
- $x_b,y_b$− the coordinates of the ball's position when it is hit;
- $r$− the radius of the ball.
Input
The first and the single line contains integers $y_1, y_2, y_w, x_b, y_b, r\ (1≤y_1,y_2,y_w,x_b,y_b≤10^6;\ y_1<y_2<y_w;\ y_b+r<y_w;\ 2·r<y_2-y_1)$.
It is guaranteed that the ball is positioned correctly in the field, doesn't cross any wall, doesn't touch the wall that Robo-Wallace is aiming at. The goal posts can't be located in the field corners.
It is guaranteed that the ball is positioned correctly in the field, doesn't cross any wall, doesn't touch the wall that Robo-Wallace is aiming at. The goal posts can't be located in the field corners.
Output
If Robo-Wallace can't score a goal in the described manner, print "-1" (without the quotes). Otherwise, print a single number xw − the abscissa of his point of aiming.
If there are multiple points of aiming, print the abscissa of any of them. When checking the correctness of the answer, all comparisons are made with the permissible absolute error, equal to $10^{-8}$.
It is recommended to print as many characters after the decimal point as possible.
If there are multiple points of aiming, print the abscissa of any of them. When checking the correctness of the answer, all comparisons are made with the permissible absolute error, equal to $10^{-8}$.
It is recommended to print as many characters after the decimal point as possible.
Sample 1 Input
4 10 13 10 3 1
Sample 1 Output
4.3750000000
other correct values of abscissa $x_w$ are also possible.
Sample 2 Input
1 4 6 2 2 1
Sample 2 Output
-1
Sample 3 Input
3 10 15 17 9 2
Sample 3 Output
11.3333333333