#include <bits/stdc++.h>
using namespace std;
long long f[100005], g[100005];
long long n, d, w;
bool solve(long long l) {
  long long total = 0, m = d;
  for (int i = 0; i < n; i++) {
    total -= g[i];
    long long cur = f[i] + total;
    if (l - cur > m) return false;
    if (i + w <= n && cur < l) {
      total += (l - cur);
      g[i + w] = l - cur;
      m -= (l - cur);
    }
  }
  return true;
}
int main() {
  cin >> n >> d >> w;
  for (int i = 0; i < n; i++) cin >> f[i];
  long long s = 1, e = 1e16;
  while (s < e) {
    memset(g, 0, sizeof g);
    long long mid = s + ((e - s + 1) / 2);
    if (solve(mid))
      s = mid;
    else
      e = mid - 1;
  }
  cout << s;
  return 0;
}
