#include <bits/stdc++.h>
using namespace std;
long long int n, m, w;
long long int a[200100], b[200100];
long long int sg[200100];
long long int mi = 0x3f3f3f3f3f3f3f3f, mx = -0x3f3f3f3f3f3f3f3f;
bool check(long long int xxx) {
  long long int k = 0, all = 0;
  memset(sg, 0, sizeof(sg));
  for (int i = 1; i <= n; i++) {
    all += sg[i];
    b[i] = a[i] + all;
    if (b[i] < xxx) {
      long long int dur = xxx - b[i];
      if (k + dur <= m) {
        sg[i] += dur;
        sg[i + w] -= dur;
        all += dur;
        k += dur;
      } else {
        return false;
      }
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mi = min(mi, a[i]);
    mx = max(mx, a[i]);
  }
  long long int low = 0, high = 2000000000LL, ans = mi, mid;
  while (low <= high) {
    mid = (low + high) / 2LL;
    if (check(mid)) {
      ans = mid;
      low = mid + 1;
    } else
      high = mid - 1;
  }
  cout << ans << endl;
  return 0;
}
