#include <bits/stdc++.h>
using namespace std;
const int N = 210000;
int a[N], n, m, w;
long long b[N];
int isok(int x) {
  long long cnt = 0, ans = 0;
  memset(b, 0, sizeof(b));
  for (int i = 1; i <= n; i++) {
    cnt += b[i];
    if (a[i] + cnt < x) {
      ans += x - a[i] - cnt;
      b[i + w] = -(x - a[i] - cnt);
      cnt += x - a[i] - cnt;
    }
  }
  if (ans <= m) return 1;
  return 0;
}
int main() {
  int maxx = 0;
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), maxx = max(maxx, a[i]);
  int l = 1, r = maxx + m + 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (isok(mid))
      l = mid + 1;
    else
      r = mid;
  }
  printf("%d\n", l - 1);
  return 0;
}
