#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
inline long long gcd(long long a, long long b) {
  a = ((a) < 0 ? -(a) : (a));
  b = ((b) < 0 ? -(b) : (b));
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
long long ext_gcd(long long A, long long B, long long *X, long long *Y) {
  long long x2, y2, x1, y1, x, y, r2, r1, q, r;
  x2 = 1;
  y2 = 0;
  x1 = 0;
  y1 = 1;
  for (r2 = A, r1 = B; r1 != 0;
       r2 = r1, r1 = r, x2 = x1, y2 = y1, x1 = x, y1 = y) {
    q = r2 / r1;
    r = r2 % r1;
    x = x2 - (q * x1);
    y = y2 - (q * y1);
  }
  *X = x2;
  *Y = y2;
  return r2;
}
inline long long modInv(long long a, long long m) {
  long long x, y;
  ext_gcd(a, m, &x, &y);
  x %= m;
  if (x < 0) x += m;
  return x;
}
inline long long power(long long a, long long p) {
  long long res = 1, x = a;
  while (p) {
    if (p & 1) res = (res * x);
    x = (x * x);
    p >>= 1;
  }
  return res;
}
inline long long bigmod(long long a, long long p, long long m) {
  long long res = 1 % m, x = a % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
inline int STRLEN(char *s) {
  int p = 0;
  while (s[p]) p++;
  return p;
}
int dir4[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
const long long inf = 10005;
const int Size = 500005;
long long N, R, K;
long long A[Size];
long long def[Size];
vector<pair<long long, long long> > G[Size], E[Size];
long long ext[Size];
bool solve(long long target) {
  memset(ext, 0, sizeof(ext));
  for (long long i = (1); i <= (N); ++i) {
    G[i].clear();
    E[i].clear();
  }
  for (long long i = (1); i <= (N); ++i) {
    if (def[i] >= target) continue;
    long long need = target - def[i];
    int u = i - R, v = i + R;
    if (u < 1) u = 1;
    if (v > N) v = N;
    G[u].push_back(make_pair(v, i));
    E[v].push_back(make_pair(need, i));
  }
  long long sum = 0;
  for (long long u = (1); u <= (N); ++u) {
    for (long long i = (0); i <= (((long long)(G[u]).size()) - 1); ++i) {
      long long v = G[u][i].first;
      long long idx = G[u][i].second;
      ext[idx] += sum;
    }
    long long mxdorkar = 0;
    for (long long i = (0); i <= (((long long)(E[u]).size()) - 1); ++i) {
      long long dorkar = E[u][i].first;
      long long idx = E[u][i].second;
      long long diyesi = sum - ext[idx];
      long long ekhondibo = dorkar - diyesi;
      mxdorkar = max(mxdorkar, ekhondibo);
    }
    sum += mxdorkar;
    if (sum > K) return false;
  }
  return true;
}
long long BST() {
  long long L = 0, R = LLONG_MAX;
  while (((L - R) < 0 ? -(L - R) : (L - R)) > 3) {
    long long mid = (L + R) / 2;
    if (solve(mid)) {
      L = mid;
    } else {
      R = mid;
    }
  }
  for (long long mid = (R); mid >= (L); --mid) {
    if (solve(mid)) return mid;
  }
  return 0;
}
long long csum[Size];
long long getsum(int u, int v) { return csum[v] - csum[u - 1]; }
void precalc() {
  for (long long i = (1); i <= (N); ++i) {
    int u = i - R, v = i + R;
    if (u < 1) u = 1;
    if (v > N) v = N;
    def[i] = getsum(u, v);
  }
}
int main() {
  scanf("%lld %lld %lld", &N, &R, &K);
  for (long long i = (1); i <= (N); ++i) {
    scanf("%lld", &A[i]);
    csum[i] = csum[i - 1] + A[i];
  }
  precalc();
  long long res = BST();
  cout << res << endl;
}
