#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int INF = 2 * 1e9;
int tmp[MAXN] = {0};
int height[MAXN] = {0};
int n, m, w;
inline int lowbit(int x) { return x & (-x); }
struct BITree {
  int a[MAXN];
  BITree() { memset(a, 0, sizeof(a)); }
  void Clear() { memset(a, 0, sizeof(a)); }
  void change(int x, int value) {
    for (int i = x; i <= n; i += lowbit(i)) a[i] += value;
  }
  int get(int x) {
    int ans = 0;
    for (int i = x; i > 0; i -= lowbit(i)) ans += a[i];
    return ans;
  }
} tree;
inline bool check(int ans) {
  int tt;
  tree.Clear();
  for (int i = 1; i <= n; i++) {
    tt = max(0, ans - height[i]);
    tree.change(i, tt);
    tree.change(i + 1, -tt);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    while (tree.get(i) > 0) {
      cnt++;
      if (cnt > m) return false;
      tree.change(i, -1);
      tree.change(i + w, 1);
    }
  }
  return true;
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  int lowh = INF, highh = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &height[i]);
    lowh = min(lowh, height[i]);
    highh = max(highh, height[i]);
  }
  int left = lowh, right = highh + m;
  while (left < right) {
    int mid = (left + right + 1) >> 1;
    if (check(mid))
      left = mid;
    else
      right = mid - 1;
  }
  printf("%d\n", left);
}
