#include <bits/stdc++.h>
using namespace std;
int n, r;
long long k;
long long a[1000005], b[1000005];
bool j(long long x) {
  memset(b, 0, sizeof b);
  long long F = 0;
  long long ud = 0;
  for (int i = 1; i <= r; ++i) {
    if (F + a[i] < x) {
      long long y = x - F - a[i];
      if (ud + y > k) return 0;
      ud += y;
      F += y;
      b[i + r] += y;
    }
  }
  for (int i = r + 1; i <= n; ++i) {
    F -= b[i - r - 1];
    if (F + a[i] < x) {
      long long y = x - F - a[i];
      if (ud + y > k) return 0;
      ud += y;
      F += y;
      b[i + r] += y;
    }
  }
  return 1;
}
int main() {
  scanf("%d%d%lld", &n, &r, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", a + i);
    b[i] = a[i] + b[i - 1];
  }
  for (int i = n + 1; i <= n + r; ++i) {
    b[i] = b[n];
  }
  for (int i = 1; i <= r; ++i) {
    a[i] = b[i + r];
  }
  for (int i = r + 1; i <= n; ++i) {
    a[i] = b[i + r] - b[i - r - 1];
  }
  long long l = 0, r = 2e18;
  while (l < r) {
    long long mid = l + r + 1ll >> 1;
    if (j(mid))
      l = mid;
    else
      r = mid - 1;
  }
  cout << l;
  return 0;
}
