#include #include #include #include #include #include #include #include #include #include #include using namespace std; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } using Int = unsigned int; using llong = long long; using Llong = unsigned long long; using ldouble = long double; using intV = vector; using llongV = vector; using llongVV = vector>; using Graph = vector>; using costGraph = vector>>; struct Edge { long long from; long long to; long long cost; }; template using asc = less(); template using desc = greater(); const llong MOD = 1e9 + 7; const llong INF = 1e17; #define FOR(i, n) for (llong i = 0; i < n; i++) #define FORS(i, a, b) for (llong i = a; i < b; i++) #define FORR(i, n) for (llong i = n; i > 0; i++) #define sup(vec, a) upper_bound(vec.begin(), vec.end(), a) - vec.begin() #define inf(vec, a) lower_bound(vec.begin(), vec.end(), a) - vec.begin() int main(void) { cin.tie(0); ios::sync_with_stdio(false); llong N, D, T; cin >> N >> D >> T; map amebaGrp; FOR(i, N) { llong x; cin >> x; llong mod = x % D; if(mod < 0) mod += D; amebaGrp[mod].push_back(x); } llong ans = N; for(auto iter : amebaGrp) { llongV grp = iter.second; if(grp.size() == 0) continue; ans += 2 * T; sort(grp.begin(), grp.end()); FORS(i, 1, grp.size()) { ans += min(2 * T, (grp[i] - grp[i - 1]) / D - 1); } } cout << ans << endl; return 0; }