#include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 25;   long long a[MAX];   int main() {     ios_base::sync_with_stdio(false);     long long n, k, h;     cin >> n >> h >> k;     for (int i = 0; i < n; i++) cin >> a[i];     long long ans = 0;     long long in = a[0];     for (int i = 1; i < n; i++) {       if (in + a[i] <= h) {         in += a[i];       } else {         double x = (a[i] + in - h) * 1.0 / k;         long long x1 = floor(x);         long long x2 = ceil(x);         long long t1 = in, t2 = in;         t1 -= x1 * k;         if (t1 < 0) t1 = 0;         if (t1 + a[i] <= h) {           in -= x1 * k;           if (in < 0) in = 0;           in += a[i];           ans += x1;           continue;         }         t2 -= x2 * k;         if (t2 < 0) t2 = 0;         if (t2 + a[i] <= h) {           in -= x2 * k;           if (in < 0) in = 0;           in += a[i];           ans += x2;         }       }     }     if (in > 0) {       long long t1 = in / k;       long long t2 = in % k;       ans += t1;       if (t2) ans++;     }     cout << ans;   }   