#include <bits/stdc++.h>
using namespace std;
int n, m, w;
long long ma, mi, ans;
long long a[100005], h[100005];
int ejz(int x) { return x & -x; }
long long sum(int pos) {
  long long ans1 = 0;
  for (int i = pos; i > 0; i -= ejz(i)) ans1 += a[i];
  return ans1;
}
void add(int pos, long long x) {
  for (int i = pos; i <= n; i += ejz(i)) a[i] += x;
}
int check(long long x) {
  long long ans1 = 0;
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++) {
    long long cd = sum(i);
    if (h[i] + cd < x) {
      ans1 += x - h[i] - cd;
      add(i, x - h[i] - cd);
      add(i + w, h[i] + cd - x);
    }
  }
  if (ans1 <= m)
    return 1;
  else
    return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &h[i]);
    if (i == 1) {
      ma = h[i];
      mi = h[i];
    } else {
      ma = max(ma, h[i]);
      mi = min(mi, h[i]);
    }
  }
  long long l = mi, r = ma + m;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid) == 1) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  printf("%lld", ans);
  return 0;
}
