#include <bits/stdc++.h>
using namespace std;
const long long int maxm = 100 * 1000 + 10, maxn = 100 * 1000 + 10,
                    maxw = 100 * 1000 + 10;
long long int n, m, w, ub = 1000 * 1000 * 1000 + 100 * 1000 + 10, lb = 1, mid;
long long int a[maxn];
long long int s[maxn];
bool can_do(int k) {
  memset(s, 0, sizeof(s));
  long long int day = 0;
  for (int i = 1; i < (n + 1); i++) {
    s[i] += s[i - 1];
    if ((a[i] + s[i]) < k) {
      day += (k - a[i] - s[i]);
      if ((i + w - 1) < (n + 1)) {
        s[i + w] -= (k - (a[i] + s[i]));
      }
      s[i] += (k - (a[i] + s[i]));
    }
  }
  return day <= m;
}
int main() {
  long long int res;
  cin >> n >> m >> w;
  for (int i = 1; i < (n + 1); i++) cin >> a[i];
  while (ub > lb) {
    mid = (lb + ub + 1) / 2;
    if (can_do(mid))
      lb = mid;
    else
      ub = mid - 1;
  }
  cout << lb << endl;
}
