#include <bits/stdc++.h>
using namespace std;
int n, m;
long long k, a[500001], b[500001];
bool check(long long x) {
  for (int i = 1; i <= n; ++i) b[i] = a[i];
  long long sum = 0, use = 0;
  for (int i = 1; i <= m; ++i) sum += b[i];
  for (int i = 1; i <= n; ++i) {
    if (i + m <= n) sum += b[i + m];
    if (i > m + 1) sum -= b[i - m - 1];
    if (sum < x) {
      long long delta = x - sum;
      sum = x;
      use += delta;
      if (use > k) return false;
      b[min(i + m, n)] += delta;
    }
  }
  return true;
}
int main() {
  scanf("%d%d%lld", &n, &m, &k);
  long long l = 1000000000, r = k;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    l = min(l, a[i]);
    r += a[i];
  }
  long long ans = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  printf("%lld\n", ans);
  return 0;
}
