#include <bits/stdc++.h>
using namespace std;
long long a[500010], k, sum[500010], tem[500010], jia[500010];
long long n, r;
bool solve(long long m) {
  long long kk = k, add = 0;
  memset(jia, 0, sizeof(jia));
  for (int i = 1; i <= n; i++) {
    if (i - r - 1 >= 1) add -= jia[i - r - 1];
    long long zuo = max(i - r, (long long)1), you = min(i + r, n);
    long long pos = sum[you] - sum[zuo - 1] + add;
    if (pos < m) {
      if (kk >= m - pos) {
        jia[you] += m - pos;
        add += (m - pos);
        kk -= (m - pos);
      } else {
        return 0;
      }
    }
  }
  return 1;
}
int main() {
  scanf("%I64d%I64d%I64d", &n, &r, &k);
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    sum[i] = sum[i - 1] + a[i];
  }
  long long l = 0, rr = 1000500000000000000;
  while (l <= rr) {
    long long mid = (l + rr) >> 1;
    if (solve(mid))
      l = mid + 1;
    else
      rr = mid - 1;
  }
  printf("%I64d\n", rr);
}
