#include <bits/stdc++.h>
using namespace std;
long long A[100010];
int N, M, W;
long long B[100010], subs[100010];
bool check(long long h) {
  long long days = 0;
  long long add = 0;
  for (int i = 1; i <= N; i++) {
    if (i > W) add -= subs[i - W];
    if (A[i] + add < h) {
      long long need = h - (A[i] + add);
      add += need;
      days += need;
      subs[i] = need;
    } else
      subs[i] = 0;
  }
  if (days > M) return false;
  return true;
}
int main() {
  cin >> N >> M >> W;
  for (int i = 1; i <= N; i++) cin >> A[i];
  long long ans = 0;
  long long minim = 0, maxim = 1000100005;
  while (minim <= maxim) {
    long long h = (minim + maxim) / 2;
    if (check(h)) {
      minim = h + 1;
      ans = max(ans, h);
    } else
      maxim = h - 1;
  }
  cout << ans << "\n";
  return 0;
}
