#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, w, m;
long long a[N], sum[N];
bool judge(long long x) {
  long long cnt = 0;
  for (int i = 1; i <= n; i++) sum[i] = 0;
  for (int i = 1; i <= n; i++) {
    sum[i] += sum[i - 1];
    if (sum[i] + a[i] < x) {
      cnt += x - sum[i] - a[i];
      if (i + w < N) sum[i + w] -= x - sum[i] - a[i];
      sum[i] += x - sum[i] - a[i];
    }
    if (cnt > m) return 0;
  }
  return 1;
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long l = 0, r = 1e12;
  long long ans = 0;
  while (l <= r) {
    long long mid = (r + l) >> 1;
    if (judge(mid)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  printf("%lld\n", ans);
  return 0;
}
