#include <bits/stdc++.h>
using namespace std;
const int N = 1100000;
long long arr[N];
long long b[N];
long long n, m, w;
bool ok(long long x) {
  memset(b, 0, sizeof(b));
  long long remain = m;
  long long c = 0;
  for (int i = 0; i < n; i++) {
    c += b[i];
    if (c + arr[i] < x) {
      long long need = x - (c + arr[i]);
      b[i + w] -= need;
      remain -= need;
      c += need;
    }
  }
  if (remain >= 0)
    return true;
  else
    return false;
}
int main() {
  while (cin >> n >> m >> w) {
    memset(arr, 0, sizeof(arr));
    for (int i = 0; i < n; i++) cin >> arr[i];
    long long l = 1;
    long long r = (long long)9e9;
    while (l < r) {
      long long mid = (l + r + 1) / 2;
      if (ok(mid)) {
        l = mid;
      } else {
        r = mid - 1;
      }
    }
    cout << l << endl;
  }
  return 0;
}
