#include <bits/stdc++.h>   using namespace std;   string tostring(int x) {     ostringstream o;     o << x;     return o.str();   }   int toint(string s) {     istringstream st(s);     int i;     st >> i;     return i;   }   const int mod = 1e9 + 7;   const int N = 1e6 + 10;   const int inf = 2e9;   const double eps = 1e-7;   const long long INF = (long long)1e18;   int n;   long long h, k;   long long a[N];   int main() {     cin >> n >> h >> k;     for (int i = 0; i < (n); ++i) cin >> a[i];     int i = 0, j = 0;     long long sum = 0;     long long left = 0;     long long ans = 0;     while (i < n) {       j = i;       sum = left;       while (j < n && sum + a[j] <= h) {         sum += a[j];         j++;       }       ans += sum / k;       left = sum % k;       if (j < n && left + a[j] > h) {         ans++;         left = 0;       }       i = j;     }     if (left) ans++;     cout << ans;     return 0;   }   