#include #include #include #include #include #include #include using namespace std; const long long INF = 1e18; int main() { long long n, d, t, x; cin >> n >> d >> t; map > aaa; for (int i = 0; i < n; i++) { cin >> x; int idx = (x + (int)1e9) % d; auto it = aaa.find(idx); if (it == aaa.end()) { aaa[idx] = vector(1, x); } else { aaa[idx].push_back(x); } } long long ans = 0; for (auto it = aaa.begin(); it != aaa.end(); it++) { long long start = -INF; long long prev = it->second[0]; ans += t; for (int i = 0; i < it->second.size(); i++) { if (start == -INF) { start = it->second[i]; prev = start; } if (it->second[i] - prev > d * t * 2) { ans += (prev - start) / d + 1; ans += t * 2; start = -INF; } prev = it->second[i]; } if (start != -INF) { ans += (prev - start) / d + 1; } ans += t; } cout << ans << endl; return 0; }