#include <bits/stdc++.h>
using namespace std;
long long k, L = 1e18, R, a[2222222], b[2222222], ans, sum[2222222];
long long cf[2222222];
int n, r;
bool check(long long m) {
  long long tmp = k, x = 0;
  memset(cf, 0, sizeof(cf));
  for (int i = 1; i <= n; ++i) {
    x += cf[i];
    if (sum[min(i + r, n)] - sum[max(i - r - 1, 0)] + x < m) {
      long long d = m - (sum[min(i + r, n)] - sum[max(i - r - 1, 0)] + x);
      if (d > tmp) return 0;
      tmp -= d;
      x += d;
      cf[i + 2 * r + 1] -= d;
    }
  }
  return 1;
}
int main() {
  scanf("%d%d%lld", &n, &r, &k);
  for (int i = 1; i <= n; i++)
    scanf("%lld", &sum[i]), sum[i] += sum[i - 1],
        L = min(sum[i] - sum[i - 1], L);
  R = 1e20;
  while (L < R) {
    long long mid = L + R >> 1ll;
    if (check(mid))
      L = mid + 1, ans = mid;
    else
      R = mid;
  }
  printf("%lld\n", ans);
}
