#include <bits/stdc++.h>
using namespace std;
int a[200005];
int sum[200005];
int required[200005];
int subtract[200006];
int main() {
  ios_base::sync_with_stdio(false);
  int i, j, k, n, m, w, t;
  cin >> n >> m >> w;
  int low = INT_MAX;
  int high = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < low) {
      low = a[i];
    }
    if (a[i] > high) {
      high = a[i];
    }
  }
  high += m;
  int ans = low;
  while (low <= high) {
    int mid = (low + high) / 2;
    int temp = m;
    int flag = 1;
    memset(required, 0, sizeof(subtract));
    memset(subtract, 0, sizeof(subtract));
    for (i = 0; i < n; i++) {
      if (a[i] < mid) {
        required[i] = mid - a[i];
      }
    }
    int pre = 0;
    for (i = 0; i < n; i++) {
      pre += subtract[i];
      if (required[i] > pre) {
        int x = required[i] - pre;
        if (x > temp) {
          flag = 0;
          break;
        }
        temp -= x;
        pre += x;
        subtract[i + w] -= x;
      }
    }
    if (flag) {
      low = mid + 1;
      ans = mid;
    } else {
      high = mid - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
