#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10, L = 20, MOD = 1e9 + 7, P = 727;
const long long inf = 2e18 + 10;
long long n, k, d, def[N], a[N], ps[N];
bool check(long long f) {
  long long need[N], ret[N];
  for (int i = 0; i < N; i++) {
    ret[i] = need[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    need[i] = max(0ll, f - def[i]);
  }
  long long ans = 0, curr = 0;
  for (int i = 1; i <= n; i++) {
    curr += ret[i];
    long long sw = need[i] - curr;
    if (curr < need[i]) {
      ans += sw, curr += sw;
      if (i + 2 * d + 1 <= n) ret[i + 2 * d + 1] -= sw;
    }
    if (ans > k) return 0;
  }
  if (ans > k)
    return 0;
  else
    return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> d >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ps[i] = ps[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++) {
    int l = max(1ll, i - d) - 1, r = min(n, i + d);
    def[i] = ps[r] - ps[l];
  }
  long long l = -1, r = inf;
  while (r - l > 1) {
    long long mid = (r + l) / 2;
    if (check(mid) == 1)
      l = mid;
    else
      r = mid;
  }
  cout << l;
}
