#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
}
long long n, r, k, su[500050] = {0}, dc[500050] = {0}, cc;
long long gmax(long long a, long long b) { return a > b ? a : b; }
long long gmin(long long a, long long b) { return a < b ? a : b; }
bool chk(long long x) {
  memset(dc, 0, sizeof(dc));
  long long cu = 0, cc = 0;
  for (int i = 1; i <= n; i++) {
    cc += dc[i];
    if (su[i] + cc < x) {
      dc[gmin(i + r + r + 1, 500020)] = cc - (x - su[i]);
      cu -= cc - (x - su[i]);
      if (cu > k) return 0;
      cc = x - su[i];
    }
  }
  return 1;
}
int main() {
  read(n);
  read(r);
  read(k);
  for (int i = 1; i <= n; i++) {
    read(cc);
    su[gmax(i - r, 0)] += cc;
    su[gmin(i + r + 1, 500020)] -= cc;
  }
  for (int i = 1; i <= n; i++) su[i] += su[i - 1];
  long long l = 0, r = 2e18;
  while (l + 1 != r) {
    long long mi = (l + r) / 2;
    if (chk(mi))
      l = mi;
    else
      r = mi;
  }
  cout << l << endl;
  return 0;
}
