#include <bits/stdc++.h>
using namespace std;
vector<int> a;
long long n, w, m;
bool check(long long h, vector<int> water) {
  long long sum = 0;
  for (int i = 0; i < a.size(); i++) {
    if (i > 0) water[i] += water[i - 1];
    if (a[i] + water[i] >= h) continue;
    long long add = (h - water[i] - a[i]);
    water[i] += add;
    if (i + w < n) water[i + w] -= add;
    sum += add;
  }
  if (sum > m)
    return false;
  else {
    return true;
  }
}
int main() {
  cin >> n >> m >> w;
  a.resize(n);
  vector<int> water;
  water.resize(n, 0);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long l = 0, r = *max_element(a.begin(), a.end()) + m;
  long long mid;
  long long ans;
  while (l <= r) {
    mid = l + (r - l) / 2;
    if (check(mid, water)) {
      l = mid + 1;
      ans = mid;
    } else {
      r = mid - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
