#include <bits/stdc++.h>
using namespace std;
const int maxN = 300000;
long long a[maxN];
long long n, w, m;
long long tmp[maxN];
bool f(long long k) {
  for (int i = 0; i <= n; i++) {
    tmp[i] = 0;
  }
  long long cur = 0;
  long long pp = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] + cur < k) {
      tmp[i + w - 1] = k - cur - a[i];
      pp += k - cur - a[i];
      cur += k - cur - a[i];
    }
    cur -= tmp[i];
  }
  if (pp <= m) {
    return true;
  } else {
    return false;
  }
}
int main() {
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long r = 2e9;
  long long l = 0;
  while (r - l > 1) {
    long long m1 = (r + l) / 2;
    if (f(m1)) {
      l = m1;
    } else {
      r = m1;
    }
  }
  if (f(r)) {
    cout << r << endl;
  } else {
    cout << l << endl;
  }
  return 0;
}
