#include <bits/stdc++.h>
using namespace std;
long long a[500005], b[500005], n, m, w, c[500005];
inline bool check(int x) {
  for (int i = 1; i <= n; i++) c[i] = b[i];
  long long tot = 0;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += c[i];
    if (sum < x) {
      c[i + w] -= x - sum;
      tot += x - sum;
      sum = x;
    } else
      continue;
  }
  return tot <= m;
}
int main() {
  scanf("%lld%lld%lld", &n, &m, &w);
  long long l = 2e10;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    l = min(l, a[i]);
  }
  for (int i = 1; i <= n; i++) b[i] = a[i] - a[i - 1];
  long long r = l + m * 2;
  long long ans = 0;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      l = mid, ans = mid;
    else
      r = mid;
  }
  if (check(r))
    ans = max(ans, r);
  else if (check(l))
    ans = max(ans, l);
  printf("%lld\n", ans);
  return 0;
}
