#include <bits/stdc++.h>
using namespace std;
int n, m, w;
int v[100010];
long long mark[100010];
bool test(long long x) {
  memset(mark, 0, sizeof mark);
  long long qnt = 0;
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    if (qnt > m) return false;
    sum -= mark[i];
    long long val = v[i] + sum;
    if (val < x) {
      qnt += x - val;
      mark[min(i + w, n)] += x - val;
      sum += x - val;
    }
  }
  return qnt <= m;
}
long long bs(long long lo, long long hi) {
  while (hi - lo > 1) {
    long long mid = (hi + lo) / 2;
    if (test(mid)) {
      lo = mid;
    } else
      hi = mid;
  }
  if (test(hi)) return hi;
  return lo;
}
int main(void) {
  cin >> n >> m >> w;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  cout << bs(0, 1000000000000000LL) << "\n";
  return 0;
}
