Problem A. Advanced drag racing

Author:I. Ludov   Time limit:1 sec
Input file:input.txt   Memory limit:256 Mb
Output file:output.txt  

Statement

There is a long discussion about drag racing as a motorsport. Some critics argue that it is too technically conditioned and hence everything there depends on a car preparation and tuning, not on driver skills. Enthusiasts may note that these things are said in such a way, as if they were something bad.

Organizers of one drag racing contest try to make their event interesting to both sides by changing some rules. The main principle is essentially the same: two participants start at the same time along parallel lines and try to pass a given range as fast as their cars allow. But still there is one very notable change. Whereas the standard drag racing track is a 400 meters straight line, this contest is conducted on a track with a single turn, connecting two straight segments of lengths L0 and L1 meters with an angle A radians between them.

Since the driver must turn, and he cannot do this instantly, he must leave the first straight segment before it ends, turn and arrive into some point of second segment with velocity parallel to this segment. During this process he should not deviate for more than D meters from segments, or else he risks to hit the border of the track. Also, rules of the contest state that there should be only one such turn.

Your car is equipped with an engine so powerful, that available acceleration is limited only by driving wheels traction. This maximum acceleration is G meters / second2 and it can push car along a straight line, decelerate car in straight line and turn car's velocity direction, leaving its amplitude unchanged, acting as a centripetal acceleration.

To win the contest you must determine an optimal strategy of passing a track. It is rather obvious, that after the turn you should accelerate as hard as possible. But the question is how to approach turn and when to start turning. Such approach will consist of maximum acceleration which may or may not be followed by maximum braking. So your task is to write a program that will find values of time durations of accelerating and braking which make your car do its best on a given track, i.e. finishes in time that is at most 0.01 seconds more than minimum possible.

Input file format

Input file contains real numbers L0 L1 A D G, length of a straight segment before turn point, length of a straight segment after turn point, turn angle in radians, maximum allowed side deviation and maximum car acceleration respectively. All lengths are given in meters.

Output file format

Output file should contain two real numbers Ta Tb, duration of acceleration and braking respectively. If braking is not needed, Tb should be equal to 0. All durations must be specified in seconds.

Constraints

0.02 ≤ A ≤ π  / 2; 1 ≤ L0, L1 ≤ 1000; 1 ≤ D ≤ 3; 1 ≤ G ≤ 20

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
50 100 1 1 10
2.22863 1.38195
2
50 100 0.1 1 10
3.015 0

0.075s 0.009s 15