#include <bits/stdc++.h>
using namespace std;
bool isok(vector<int> &arr, int mid, int m, int w) {
  int n = arr.size();
  vector<long long> temp(n, 0);
  long long cnt = 0, rem = 0;
  for (int i = 0; i < n; i++) {
    if (i - w >= 0) {
      rem -= temp[i - w];
    }
    if (arr[i] + rem < mid) {
      temp[i] = mid - arr[i] - rem;
      rem += temp[i];
      cnt += temp[i];
    }
  }
  if (cnt > m) return false;
  return true;
  cout << cnt << " " << mid << endl;
  if (cnt <= m) return true;
  return 0;
}
void solve() {
  int n, m, w;
  cin >> n >> m >> w;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  long long lo = 0, hi = 1e9 + 1e5, ans, mid;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (isok(h, mid, m, w)) {
      lo = mid + 1;
      ans = mid;
    } else
      hi = mid - 1;
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
