#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int n, w, m;
int64_t ar[N], tmp[N];
bool check(int64_t mid) {
  int64_t cnt = 0;
  for (int i = 1; i <= n; i++) tmp[i] = 0;
  for (int i = 1; i <= n; i++) {
    tmp[i] += tmp[i - 1];
    int64_t del = mid - (tmp[i] + ar[i]);
    if (del <= 0) continue;
    cnt += del;
    tmp[i] += del;
    tmp[i + w] += -del;
  }
  return (cnt <= m);
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; i++) scanf("%d", &ar[i]);
  int64_t lo = 1, mid, hi = 1e10, ans = 1;
  while (lo <= hi) {
    mid = (lo + hi) >> 1;
    if (check(mid))
      ans = mid, lo = mid + 1;
    else
      hi = mid - 1;
  }
  printf("%lld", ans);
  return 0;
}
