#include <bits/stdc++.h>
using namespace std;
const int maxn = 500010;
int n, r;
long long k, a[maxn], b[maxn];
bool chk(long long x) {
  long long s = 0;
  memset(b, 0, sizeof(b));
  for (int i = 1; i <= n; i++) {
    b[max(1, i - r)] += a[i];
    b[min(n, i + r) + 1] -= a[i];
  }
  for (int i = 1; i <= n; i++) {
    b[i] += b[i - 1];
    if (b[i] < x) {
      s += x - b[i];
      b[min(n, i + r + r) + 1] -= x - b[i];
      b[i] += x - b[i];
    }
    if (s > k) return 0;
  }
  return 1;
}
int main() {
  scanf("%d %d %lld", &n, &r, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  long long l = 0, r = 2e18, ans;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    chk(mid) ? l = (ans = mid) + 1 : r = mid - 1;
  }
  printf("%lld\n", ans);
  return 0;
}
