#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
struct station {
double per_price;
double distance;
};
bool cmp(const station &s1, const station &s2) {
return s1.distance < s2.distance;
}
int main() {
double tank_c, distance, unit_d;
int n;
while (scanf(" %lf%lf%lf%d", &tank_c, &distance, &unit_d, &n) != EOF) {
double cost = 0;
double current_dis = 0;
double current_tank = 0;
double MAX_LEN = tank_c * unit_d;
station stations[n + 1];
for (int i = 0; i < n; ++i) {
scanf(" %lf %lf", &stations[i].per_price, &stations[i].distance);
}
station temp = {0, distance};
stations[n++] = temp;
sort(stations, stations + n, cmp);
if (stations[0].distance != 0) {
printf("The maximum travel distance = 0.00\n");
break;
}
//当前站点
int k = 0;
while (current_dis < distance) {
int nextK = k;
int min_k = k;
double min_price = 999;
double max_distance = MAX_LEN + current_dis;
if (stations[k + 1].distance - current_dis > MAX_LEN) break;
bool flag = false;
for (int i = k + 1; i < n && stations[i].distance <= max_distance; ++i) {
if (stations[i].per_price < stations[k].per_price) {
flag = true;
nextK = i;
break;
}
if (stations[i].per_price < min_price) {
min_price = stations[i].per_price;
min_k = i;
}
}
double left = current_tank * unit_d;
//
if (flag) {
cost += ((stations[nextK].distance -stations[k].distance - left) / unit_d) * stations[k].per_price;
k = nextK;
current_dis = stations[nextK].distance;
current_tank = 0;
} else {
//加满
cost += ((MAX_LEN -left) / unit_d) * stations[k].per_price;
current_dis = stations[min_k].distance;
current_tank = tank_c - (stations[min_k].distance - stations[k].distance)/unit_d;
k = min_k;
}
}
if (current_dis == distance)
printf("%.2lf\n", cost);
else
printf("The maximum travel distance = %.2lf\n", stations[k].distance + MAX_LEN);
}
return 0;
}