#include <iostream>
#include <cstdio>
using namespace std;

const int MAXCARS = 20;
const bool DEBUG = false;
const double EPS = 0.000000001;

struct car {
	double l;
	int s;
} cars[MAXCARS];

int main()
{
	int s, d, icase = 0;
	double l;
	int n;
	cin >> l >> s >> d >> n;
	double time = 0.0;
	while (l != 0 || s != 0) {
		icase++;
		for(int i=0; i<n; i++) {
			cin >> cars[i].l >> cars[i].s;
		}
		while (true) {
			l += 0.25*s;
			if (l > d) {
				time += (d-l+0.25*s)/s;
				break;
			}
			time += 0.25;

			double newSpeed = s;
			int num = 1;
												// determine which cars are next to Anna's car
			for(int i=0; i<n; i++) {
				cars[i].l += 0.25*cars[i].s;
				if (cars[i].l <= l && cars[i].l >= l-1) {
if (DEBUG) {
cout << "car " << i << " located at " << cars[i].l << " at time " << time << " with speed " << cars[i].s << endl;
cout << "    difference = " << l - cars[i].l << endl;
}
					newSpeed = newSpeed + cars[i].s;
					num++;
				}
			}
			s = newSpeed/num;
if (DEBUG && num > 1) {
cout << "speed changed to " << s;
cout << " at location " << l;
cout << " at time " << time << endl << endl;
}
			if (l == d)
				break;
		}
		cout << "Case " << icase << ": ";
//		cout << "Anna reaches her destination at time " << time;
//		cout << " at a speed of " << s << endl;
		printf("Anna reaches her destination at time %.4f at a speed of %d\n", time, s); 
			
		cin >> l >> s >> d >> n;
		time = 0.0;
	}
}
