#include <bits/stdc++.h>
using namespace std;
long long a[200001], b[200001], n, m, w;
bool check(long long x) {
  long long next = 0, sum = 0;
  memset(b, 0, sizeof(b));
  for (int i = 0; i < n; i++) {
    sum += b[i];
    if (a[i] + sum <= x) {
      b[i + w] -= x - a[i] - sum;
      next += x - a[i] - sum;
      sum = x - a[i];
    }
  }
  return next <= m;
}
long long find(long long l, long long r) {
  if (l > r) return r;
  long long mid = (l + r) >> 1;
  if (check(mid))
    return find(mid + 1, r);
  else
    return find(l, mid - 1);
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 0; i < n; i++) scanf("%I64d", a + i);
  printf("%I64d", find(0, 2e9));
}
