#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
long long n, m, w;
long long a[N], c[N];
long long l = 0x3f3f3f3f, r;
int check(long long x) {
  long long sum = 0, cnt = 0;
  for (int i = 1; i <= n; i++) {
    cnt += c[i];
    if (cnt < x) {
      sum += x - cnt;
      c[i] += x - cnt;
      if (i + w <= n) c[i + w] -= x - cnt;
      cnt += x - cnt;
    }
  }
  if (sum <= m) return true;
  return false;
}
int main() {
  cin >> n >> m >> w;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    c[i] = a[i] - a[i - 1];
    l = min(l, a[i]);
    r = max(r, a[i]);
  }
  long long mid;
  r = r + m + 1;
  while (l <= r) {
    mid = l + r >> 1;
    if (check(mid))
      l = mid + 1;
    else
      r = mid - 1;
    for (int i = 1; i <= n; i++) c[i] = a[i] - a[i - 1];
  }
  cout << r;
  return 0;
}
