#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline long long read1() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 1010000;
int n, m;
long long k, a[N], b[N];
bool check(long long t) {
  for (int i = 1; i <= n; i++) b[i] = 0;
  long long A = 0, s = k;
  for (int i = 1; i <= m + 1; i++) A += a[i];
  for (int i = 1; i <= n; i++) {
    if (A < t) {
      s -= t - A;
      if (s < 0) return 0;
      b[min(n, i + m)] += t - A;
      A = t;
    }
    if (i >= m) A -= a[i - m] + b[i - m];
    if (i + 1 + m <= n) A += a[i + 1 + m];
  }
  return s >= 0;
}
int main() {
  n = read();
  m = read();
  k = read1();
  long long ans = 0, l = 0, r = k;
  for (int i = 1; i <= n; i++) {
    a[i] = read1();
    r += a[i];
  }
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  printf("%lld\n", ans);
  return 0;
}
