#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int s = 0, f = 0;
  register char ch = getchar();
  while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
  while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
  return f ? -s : s;
}
int n, m, w;
const int MAX = 500015;
int sum[MAX], a[MAX];
bool solve(int x) {
  int res = 0, b = m;
  for (register int i = 1; i <= n; i = -~i) {
    if (i >= w) res -= sum[i - w];
    sum[i] = max((int)0, x - res - a[i]);
    res += sum[i];
    b -= sum[i];
    if (b < 0) return 0;
  }
  return 1;
}
signed main() {
  n = read(), m = read(), w = read();
  int minn = (1 << 30);
  for (register int i = 1; i <= n; i = -~i) {
    a[i] = read();
    minn = min(a[i], minn);
  }
  int maxx = minn + m;
  int mid = (minn + maxx) / 2 + 1;
  while (minn < maxx) {
    if (solve(mid))
      minn = mid;
    else
      maxx = mid - 1;
    mid = (minn + maxx) / 2 + 1;
  }
  printf("%d", minn);
  return 0;
}
