#include <bits/stdc++.h>
using namespace std;
int A[100005], D[100005], n, m, w, L[100005];
bool go(int h) {
  fill(L, L + n, 0);
  for (int i = 0; i < n; ++i) D[i] = max(h - A[i], 0);
  int pow = 0, cap = m, d;
  for (int i = 0; i < n; ++i) {
    pow -= L[i];
    d = max(D[i] - pow, 0);
    if (d > cap) return false;
    pow += d;
    cap -= d;
    if (i + w < n) L[i + w] += d;
  }
  return true;
}
int main() {
  std::ios::sync_with_stdio(false);
  int mini = 2e9;
  cin >> n >> m >> w;
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
    mini = min(mini, A[i]);
  }
  int lo = mini, hi = mini + m + 1, mid;
  while (hi - lo > 1) {
    mid = (hi + lo) >> 1;
    if (go(mid))
      lo = mid;
    else
      hi = mid;
  }
  cout << lo << endl;
}
