#include <bits/stdc++.h>
using namespace std;
long long n, m, w;
long long sum[200006], h[200006], t;
bool check(long long);
int main() {
  cin >> n >> m >> w;
  long long minn = 0x7f7f7f7f;
  for (long long i = 0; i < n; ++i)
    scanf("%I64d", &h[i]), minn = min(minn, h[i]);
  long long l = minn, r = minn + m;
  while (l <= r) {
    long long mid = l + r >> 1;
    if (check(mid))
      l = mid + 1;
    else
      r = mid - 1;
  }
  cout << l - 1;
}
bool check(long long st) {
  memset(sum, 0, sizeof sum);
  t = 0;
  long long cur = 0, tot = 0;
  for (int i = 0; i < n; ++i) {
    cur -= sum[i];
    if (h[i] + cur < st)
      tot += st - h[i] - cur, sum[i + w] = st - h[i] - cur,
                                      cur += st - h[i] - cur;
  }
  if (tot > m) return false;
  return true;
}
