#include <bits/stdc++.h>
using namespace std;
long long n, m, w, v[300123], out[300123];
int f(long long x) {
  long long qtd = 0, sum = 0, dif;
  for (int i = 0; i < n; ++i) out[i] = 0;
  for (int i = 0; i < n; ++i) {
    sum -= out[i];
    if (v[i] + sum < x) {
      dif = x - v[i] - sum;
      out[i + w] = dif;
      qtd += dif;
      sum += dif;
    }
  }
  return qtd > m;
}
int main() {
  scanf("%lli %lli %lli", &n, &m, &w);
  for (int i = 0; i < n; ++i) {
    scanf("%lli", &v[i]);
  }
  long long lo = 1, mid, hi = 2000000123;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    if (f(mid)) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  printf("%lli\n", lo - 1);
  return 0;
}
