#include <bits/stdc++.h>
using namespace std;
long long int n, m, w;
long long int arr[100005];
inline long long int solve(long long int x) {
  long long int curr = 0;
  long long int moves = 0;
  long long int used;
  vector<long long int> vec(n + 1, 0);
  for (long long int i = 0; i < n; i++) {
    curr += vec[i];
    if (curr + arr[i] < x) {
      used = x - (curr + arr[i]);
      moves += used;
      curr = x - arr[i];
      if (i + w < n) vec[i + w] -= used;
    }
  }
  if (moves <= m) return 1;
  return 0;
}
int main() {
  long long int lt = 1;
  long long int rg = 1000000000 + 100000;
  long long int res;
  scanf("%I64d %I64d %I64d", &n, &m, &w);
  for (long long int i = 0; i < n; i++) scanf("%lld", &arr[i]);
  while (lt <= rg) {
    long long int mid = (lt + rg) >> 1;
    if (solve(mid)) {
      res = mid;
      lt = mid + 1;
    } else
      rg = mid - 1;
  }
  printf("%I64d\n", res);
  return 0;
}
