#include <bits/stdc++.h>
using namespace std;
long long a[500005], b[500005];
int main() {
  int n, r;
  long long k;
  scanf("%d%d%lld", &n, &r, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long lo = 0, hi = 2e18, ans = 0;
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    for (int i = 1; i <= n; i++) b[i] = a[i];
    int s = 1, e = min(n, s + r);
    long long sum = 0, K = k;
    for (int i = s; i <= e; i++) sum += a[i];
    bool ok = 1;
    for (int i = 1; i <= n; i++) {
      while (i - s > r) sum -= b[s], s++;
      while (e - i < r && e < n) e++, sum += b[e];
      if (sum < mid) {
        if (K < mid - sum) {
          ok = 0;
          break;
        } else {
          K -= mid - sum;
          b[e] += mid - sum;
          sum = mid;
        }
      }
    }
    if (ok)
      ans = mid, lo = mid + 1;
    else
      hi = mid - 1;
  }
  printf("%lld\n", ans);
}
