#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
const int inf = 1e9 + maxn * 2;
int n, m, w;
int a[maxn + 10];
int dp[maxn + 10];
bool check(int mid) {
  int mm = m;
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i] += dp[i - 1];
    dp[i - 1] = 0;
    int data = a[i] + dp[i];
    if (data < mid) {
      int num = mid - data;
      if (num <= mm) {
        mm -= num;
        dp[i] += num;
        dp[min(n + 1, i + w)] -= num;
      } else {
        for (int j = i; j <= n + 1; j++) dp[j] = 0;
        return false;
      }
    }
  }
  dp[n] = 0;
  dp[n + 1] = 0;
  return true;
}
int main() {
  while (~scanf("%d%d%d", &n, &m, &w)) {
    int ans = inf;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      ans = min(ans, a[i]);
    }
    int l = 0, r = inf;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (check(mid)) {
        l = mid + 1;
        ans = mid;
      } else {
        r = mid - 1;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
