#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
long long n, m, w, a[N], dis[N];
long long l = 2147483648, r = -1;
inline void getin() {
  scanf("%lld%lld%lld", &n, &m, &w);
  for (register int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    dis[i] = a[i] - a[i - 1];
    l = min(l, a[i]);
    r = max(a[i], r);
  }
}
inline bool check(long long h) {
  long long cur = 0, days = 0;
  for (register int i = 1; i <= n; ++i) {
    cur += dis[i];
    if (cur < h) {
      days += h - cur;
      dis[i] += h - cur;
      if (i + w <= n) dis[i + w] -= h - cur;
      cur += h - cur;
    }
  }
  return days <= m;
}
inline void deal() {
  r += m + 1;
  while (r - 1 > l) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid;
    for (register int i = 1; i <= n; ++i) dis[i] = a[i] - a[i - 1];
  }
}
int main() {
  getin();
  deal();
  cout << l;
  return 0;
}
