#include <bits/stdc++.h>
using namespace std;
long long N, M, W;
long long h[100010], dis[100010];
bool check(long long H) {
  long long cur = 0, dsum = 0;
  for (int i = 1; i <= N; i++) {
    cur += dis[i];
    if (cur < H) {
      dsum += H - cur;
      dis[i] += H - cur;
      if (i + W <= N) dis[i + W] -= H - cur;
      cur += H - cur;
    }
  }
  return dsum <= M;
}
int main() {
  scanf("%lld%lld%lld", &N, &M, &W);
  long long l = 111111111, r = -1;
  for (int i = 1; i <= N; i++) {
    scanf("%lld", &h[i]);
    dis[i] = h[i] - h[i - 1];
    l = min(h[i], l);
    r = max(h[i], r);
  }
  r += M + 1;
  while (l < r - 1) {
    long long m = (l + r) / 2;
    if (check(m))
      l = m;
    else
      r = m;
    for (int i = 1; i <= N; i++) dis[i] = h[i] - h[i - 1];
  }
  printf("%lld", l);
  return 0;
}
