#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int n, r;
long long k, a[N], b[N];
long long check(long long v) {
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    b[i] = a[i];
    if (i <= r) {
      sum += b[i];
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i + r <= n) sum += b[i + r];
    if (i - r - 1 > 0) sum -= b[i - r - 1];
    if (sum < v) {
      ans += v - sum;
      if (ans > k) return ans;
      b[min(i + r, n)] += v - sum;
      sum = v;
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> r >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long l = 0, r = 2e18;
  while (l < r) {
    long long m = l + (r - l) / 2;
    if (check(m) <= k) {
      l = m + 1;
    } else {
      r = m;
    }
  }
  cout << (l - 1) << '\n';
}
