Anna just got a new car and wants to take it out on the highway. To lower her chance of getting a speeding ticket, she does not want to drive much faster than anyone else on the highway. She also does not want to drive too slowly, no matter how slowly the other drivers go. So she settled on this strategy. Every time she passes a car, she drops her speed to the average of her old speed and that car's speed. When a car passes her, she raises her speed the same way.
To carry out the strategy she built a small gizmo that checks for passing or passed cars 4 times each second. At every check it sets her car's speed to the average of her current speed and the speeds of all cars she is passing or that are passing her at that instant, rounding the average down to the nearest integer. For example, if at some quarter second Anna is going 60, is being passed by a car going 65, and is also passing another car going 59, her car changes its speed to ⌊(60+65+59)/3⌋=61.
For this problem, Anna is passing a car or being passed by it if the front of the other car is anywhere between the back and the front of Anna's car, inclusive. All cars have the same length, and locations and distances are measured in car lengths, so each car is 1 long. Every car except Anna's travels at a constant speed. Anna's car changes speed instantaneously.
The input holds several test cases.
The first line of each test case has four non-negative integers l, s, d, n. l is Anna's current location on the highway (in car lengths), s is her current speed (in car lengths per second), d is the location of a destination point on the highway with l<d≤100000000, and n is the number of other vehicles on the road, all going in Anna's direction. The maximum value of n is 100.
The next n lines each hold a pair of integers li si (1≤i≤n), the location and the speed of the i-th vehicle. Every location refers to the front of the car in question and is at most 100000000. All input refers to locations and speeds at time t=0, which is also the time Anna's gizmo takes its first reading.
A line containing four 0's terminates the input. Do not process that line.
Every test case guarantees that Anna reaches the destination.
For each test case print one line with the time Anna reaches the destination point (in seconds) and her speed at that time (in car lengths per second). The destination point is reached the moment the front of Anna's car touches it. If her arrival time falls exactly on a quarter second and she is passing or being passed at that same instant, print her new averaged speed.
Use this format for test case k.
Case k: Anna reaches her destination at time T at a speed of S
T is the arrival time rounded to the nearest ten-thousandth, always written with four digits after the decimal point. S is the speed, printed as an integer.