#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long n, m, w, ai;
long long cnt[300005];
bool go(long long mx) {
  memset(cnt, 0, sizeof cnt);
  long long use = m;
  long long add = 0;
  for (int i = 0; i < n; i++) {
    add += cnt[i];
    long long curr = v[i] + add;
    if (curr >= mx) continue;
    if (mx - curr > use) return 0;
    add += (mx - curr);
    cnt[i + w] -= (mx - curr);
    use -= (mx - curr);
  }
  return 1;
}
int main() {
  cin >> n >> m >> w;
  for (int i = 0; i < n; i++) {
    cin >> ai;
    v.push_back(ai);
  }
  long long l = 1, r = 10000000000ll, bst = -1;
  while (l <= r) {
    long long mid = (l + r) / 2ll;
    if (go(mid)) {
      bst = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  cout << bst;
}
