#include <bits/stdc++.h>
using namespace std;
int n, m;
long long k, a[500010], b[500010], cf[500010];
bool check(long long p) {
  for (int i = 1; i <= n; i++) b[i] = max(0ll, p - a[i]), cf[i] = 0;
  cf[n + 1] = 0;
  long long now = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    now += cf[i], ans = min(ans + (b[i] = max(b[i] + now, 0ll)), k + 1);
    cf[min(n + 1, i + 2 * m + 1)] += b[i];
    now -= b[i];
  }
  return ans <= k;
}
int main() {
  scanf("%d%d%lld", &n, &m, &k);
  long long v;
  for (int i = 1; i <= n; i++)
    scanf("%lld", &v), a[max(i - m, 1)] += v, a[min(n + 1, i + m + 1)] -= v;
  for (int i = 1; i <= n; i++) a[i] += a[i - 1];
  long long l = 0, r = 2e18, ans;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return printf("%lld", ans), 0;
}
