#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000000LL;
struct big {
  long long a, ile;
  big(long long A = 0LL) {
    a = A;
    ile = 0;
    while (a >= INF) {
      a -= INF;
      ile++;
    }
  }
  void propag() {
    while (a >= INF) {
      a -= INF;
      ile++;
    }
    while (a < 0) {
      a += INF;
      ile++;
    }
  }
  bool operator<(const big &c) const {
    if (ile != c.ile) return ile < c.ile;
    return a < c.a;
  }
  big operator+(const big &c) const {
    big d = big(0LL);
    d.ile = ile + c.ile;
    d.a = c.a + a;
    if (d.a >= INF) {
      d.a -= INF;
      d.ile++;
    }
    return d;
  }
  big operator-(const big &c) const {
    big d = big(0);
    d.ile = ile - c.ile;
    d.a = a - c.a;
    while (d.a < 0) {
      d.a += INF;
      d.ile--;
    }
    return d;
  }
};
template <typename T>
void dbg(T a) {}
template <typename T, typename... Arg>
void dbg(T a, Arg... arg) {}
const int maxn = (1e6) + 7;
const int inf = (1e9) + 7;
const big LLinf = (1e18) + 7;
const long double eps = 1e-9;
const big mod = 1e9 + 7;
const int pot = 1 << 20;
big tab[maxn];
big tree[2 * pot + 7];
big pref[maxn];
int n, r;
big k;
void wypisz(big a) {
  long long b = a.a;
  vector<int> V;
  while (b) {
    V.push_back(b % 10);
    b /= 10;
  }
  V.resize(22);
  b = a.ile;
  int wsk = 18;
  while (b) {
    V[wsk++] = b % 10;
    b /= 10;
  }
  while (((int)(V).size()) > 1 && V.back() == 0) V.pop_back();
  for (int i = ((int)(V).size()) - 1; i >= 0; i--) cout << V[i];
  cout << endl;
}
bool czy(big x) {
  big cur = big(0LL);
  for (int i = 1; i <= n; i++) tree[i] = big(0LL);
  big cnt = big(0LL);
  for (int i = 1; i <= n; i++) {
    cur = cur + tree[i];
    big ile = max(big(0), x - pref[i] - cur);
    cnt = cnt + ile;
    cur = cur + ile;
    if (k < cnt) {
      return 0;
    }
    tree[min(i + 2 * r + 1, n + 1)] = tree[min(i + 2 * r + 1, n + 1)] - ile;
  }
  return cnt < k + big(1);
}
big div(big a) {
  if (a.ile & 1) a.a += INF;
  a.a /= 2LL;
  a.ile /= 2LL;
  while (a.a > INF) {
    a.ile++;
    a.a -= INF;
  }
  return a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> r >> k.a;
  if (k.a >= INF) {
    k.a -= INF;
    k.ile++;
  }
  for (int i = 1; i <= n; i++) {
    cin >> tab[i].a;
    pref[max(i - r, 1)] = pref[max(i - r, 1)] + tab[i];
    pref[min(i + r + 1, n + 1)] = pref[min(i + r + 1, n + 1)] - tab[i];
  }
  big suma = 1LL;
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i] + pref[i - 1];
    suma = suma + pref[i];
  }
  big l = 0LL;
  big p = k + suma + big(1LL);
  while (l + big(1) < p) {
    big sr = div((l + p));
    if (czy(sr))
      l = sr;
    else
      p = sr;
  }
  while (czy(l + big(1))) l = l + big(1);
  wypisz(l);
  return 0;
}
