#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long a, b, c;
long long der[300001];
long long st(long long c, long long st) {
  long long c1 = c;
  while (st > 1) {
    st--;
    c *= c1;
  }
  return c;
}
bool check(long long m, long long p) {
  if (m > 1000000000)
    return false;
  else {
    long long sum = 0;
    while (m > 0) {
      sum += m % 10;
      m /= 10;
    }
    if (sum == p)
      return true;
    else
      return false;
  }
  return false;
}
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long logar(long long N) {
  long long res = 1;
  long long r = 0;
  while (res < N) {
    r++;
    res *= 2;
  }
  return res;
}
long long dermax(int l, int r) {
  long long ans = 0;
  while (l <= r) {
    if (l % 2 == 1) {
      ans += der[l];
    }
    if ((r % 2 == 0)) ans += der[r];
    l = (l + 1) / 2;
    r = (r - 1) / 2;
  }
  return ans;
}
void update(int n, long long x) {
  while (n > 0) {
    der[n] += x;
    n /= 2;
  }
}
int main() {
  long long n;
  cin >> n;
  vector<long long> c;
  long long m, w;
  cin >> m >> w;
  long long min = 1000000000;
  for (int i = 1; i <= n; i++) {
    long long k;
    cin >> k;
    v.push_back(k);
    if (k < min) min = k;
  }
  long long l = 0;
  long long rr = min + m;
  while (rr - l > 1) {
    long long mid = (rr + l) / 2;
    vector<long long> r;
    for (int i = 0; i < v.size(); i++) r.push_back(max(0, mid - v[i]));
    long long sum = 0;
    long long N;
    N = logar(n);
    for (int j = 0; j <= 2 * N; j++) der[j] = 0;
    for (int i = 0; i < v.size(); i++) {
      long long max1 = dermax(max(i + N - w + 1, N), i + N);
      sum += max(0, r[i] - max1);
      update(i + N, max(0, r[i] - max1));
    }
    if (sum > m) {
      rr = mid - 1;
    } else {
      l = mid;
    }
  }
  long long mid = rr;
  vector<long long> r;
  for (int i = 0; i < v.size(); i++) r.push_back(max(0, mid - v[i]));
  long long sum = 0;
  long long N;
  N = logar(n);
  for (int j = 0; j <= 2 * N; j++) der[j] = 0;
  for (int i = 0; i < v.size(); i++) {
    long long max1 = dermax(max(N, i + N - w + 1), i + N);
    sum += max(0, r[i] - max1);
    update(i + N, max(0, r[i] - max1));
  }
  if (sum > m) {
    cout << l;
  } else
    cout << rr;
}
