#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
long long a[maxn];
long long tmp[maxn];
int n, rad;
long long k;
int check(long long ans) {
  memcpy(tmp, a, sizeof(a));
  long long sum = 0;
  long long archer = k;
  int l = 1, r = rad + 1;
  for (int i = 1; i <= min(n, r); i++) {
    sum += tmp[i];
  }
  for (int i = 1; i <= n; i++) {
    if (sum < ans) {
      archer -= ans - sum;
      if (archer < 0) return 0;
      tmp[r] += ans - sum;
      sum = ans;
    }
    if (r < n) {
      r++;
      sum += tmp[r];
    }
    if (i > rad) {
      sum -= tmp[l];
      l++;
    }
  }
  return 1;
}
int main() {
  scanf("%d %d %I64d", &n, &rad, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
  }
  long long l = 0, r = 1e18 + 5e15;
  long long ans = 0;
  while (l <= r) {
    long long mid = (r - l) / 2LL + l;
    if (check(mid)) {
      ans = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
