# Subway

Time Limit: Java: 2000 ms / Others: 2000 ms

Memory Limit: Java: 65536 KB / Others: 65536 KB

## Description

Subway trains are meant to move people as quickly, safely, and comfortablyas possible from station to station. Although the train drivers' unionsmay not agree, computer operated trains accomplish these goals moreeffectively than human operated trains. You are to determinethe optimal control strategy to move the train from one station to anotherwithin the constraints imposed by safety and comfort considerations,as well as the physical limitations of the train itself.

The parameters to the problem are all positive integers not greater than 1000.

• d - the distance between stations, in metres
• m - the maximum allowable speed of the train, in metres/sec
• a - the maximum absolute acceleration of the train, in metres/sec2
• j - the maximum absolute jerk, in metres/sec3
The train must be completely stopped at each station and must move in onedirection at speeds not exceeding m. Acceleration can be positive (forward) or negative (backwards)but its absolute value must not exceed a.The last parameter, jerk, is the rate of change of acceleration in either direction. That is, acceleration cannot increase or decrease at greaterthan this rate. This parameter prevents toppling the standing passengers.

There are several test cases. For each test case, standard input has asingle line with d, m, a, j. For each test case, standardoutput should contain a single line giving the minimum time in seconds,to the nearest 0.1 second, required to move between the stations.

None

None

## Sample Input

1000 70 20 1

## Sample Output

31.7

None

## Source

University of Waterloo Local Contest 2001.06.