#include <bits/stdc++.h>
using namespace std;
int a[100010], vis[100010];
int n, m, w;
bool Judge(int x) {
  int i, j, k, sum, t;
  k = m;
  memset(vis, 0, sizeof(vis));
  sum = 0;
  for (i = 0; i < n; i++) {
    sum += vis[i];
    if (sum + a[i] < x) {
      t = x - (sum + a[i]);
      vis[i] += t;
      if (i + w <= n) vis[i + w] -= t;
      k -= t;
      if (k < 0) return false;
      sum += t;
    }
  }
  if (k < 0)
    return false;
  else
    return true;
}
int main(void) {
  int i, j, k, L, R, mi;
  scanf("%d%d%d", &n, &m, &w);
  mi = 1e9 + 10;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    mi = min(mi, a[i]);
  }
  L = mi;
  R = mi + m + 1;
  while (L < R) {
    mi = (L + R) >> 1;
    if (Judge(mi) == 0)
      R = mi;
    else
      L = mi + 1;
  }
  printf("%d\n", R - 1);
  return 0;
}
