Street racing
You are at a traffic light in your car, and beside or across from you is someone just like you. You don't know them, but you both sense what's about to happen. Without honking or revving your engines, you both understand: it's time to see whose car is faster. At the signal, with the screech of tires and the roar of exhaust, you both take off. Among all the cars at the light, only you two race. If one of them is you, then you're a true street racer.
Siberian racers often gather on an unfinished runway outside the city. The meeting point is the fork before Tolmachevo Airport, where you turn left and drive for about five minutes. Then, a right turn onto the spare strip, and you're there. Races are held both day and night.
One night, the traffic police set up speed limit signs along the track and a radar trap. The next race had to comply with the speed limits. Remember, a speed limit sign requires you to not exceed the indicated speed. The sign's effect starts at its location and ends at the next sign. From the track's start to the first sign, the usual limit is 90 km/h.
What is the minimum possible time for your car to complete the track if your engine can accelerate at a maximum of a_1 m/s² and decelerate at a maximum of a_2 m/s²? At the start, your car is stationary.
Input
The first line contains a real number S - the track's length (0 < S <= 10000 m).
The second line contains two real numbers a_1 and a_2 (0 < a_1, a_2 <= 10 m/s²). The third line contains an integer N - the number of installed signs (0 <= N <= 100). The next N lines provide pairs of real numbers S_i, V_i, separated by a space - the distance from the track's start where the i-th sign is installed (1 <= i <= N) and the speed limit in km/h indicated on it (0 <= S_i < S, 0 < V_i <= 500), respectively. The signs are listed in order of their distance from the start (S_i < S_{i+1} for 1 <= i < N).
Output
The output should be a single real number with six decimal places - the minimum time in seconds.