#include <bits/stdc++.h>
using namespace std;
long long n, r, k;
const int maxn = 500005;
long long a[maxn];
long long b[maxn];
bool check(long long x) {
  memset(b, 0, sizeof(b));
  long long s = k;
  long long ss = 0;
  for (int i = 0; i <= r; ++i) ss += a[i];
  for (int i = 0; i < n; ++i) {
    if (ss < x) {
      if (s >= x - ss)
        b[min(n, i + r)] += x - ss, s -= (x - ss), ss = x;
      else
        return false;
    }
    if (i + 1 + r < n) ss += a[i + 1 + r];
    if (i - r >= 0) ss -= a[i - r] + b[i - r];
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> r >> k;
  long long mx = 0;
  for (int i = 0; i < n; ++i) cin >> a[i], mx += a[i];
  long long l = 0, r = mx + k + 1;
  long long mid, ans;
  while (l < r) {
    mid = l + (r - l) / 2;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid;
  }
  cout << ans << endl;
  return 0;
}
