#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[100005];
long long sum[100005];
bool ok(long long x) {
  for (int i = 0; i < n; ++i) sum[i] = 0;
  long long needed = 0;
  for (int i = 0; i < n; ++i) {
    long long val = x - a[i];
    if (val > 0) {
      val -= sum[i];
      if (val > 0) {
        needed += val;
        sum[i] += val;
        if (i + k < n) sum[i + k] -= val;
      }
    }
    sum[i + 1] += sum[i];
    if (needed > m) return false;
  }
  return true;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  long long le = 0, ri = 2000000000;
  while (le + 1 < ri) {
    long long mid = (le + ri) >> 1;
    if (ok(mid))
      le = mid;
    else
      ri = mid;
  }
  cout << le << endl;
  return 0;
}
