#include <bits/stdc++.h>
using namespace std;
int main() {
long B,P,D,N;
cin >> B >> P >> D >> N;
vector<long> places(N+2);
places[0] = 0, places.back() = B;
for (int i = 0; i < N; i++)
cin >> places[i+1];
vector values(N+1,vector<long>(P));
for (int i = 0; i < N+1; i++) {
const long dist = places[i+1] - places[i];
for (int j = 0; j < P; j++) {
const long timeBefore = (P + j - dist % P) % P;
long value = LONG_MAX;
if (i != 0) {
for (int h = 0; h < P; h++)
value = min(value, values[i-1][h] + (h > timeBefore ? P - h + timeBefore : timeBefore - h));
} else
value = timeBefore;
values[i][j] = (dist + timeBefore - 1)/P * D + dist + value;
}
}
long minimum = LONG_MAX;
for (int i = 0; i < P; i++)
minimum = min(minimum,values.back()[i]);
cout << minimum;
}