#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 1000005;
const double PI = 4 * atan(1);
const double eps = 1e-7;
long long n, m, w;
long long a[N];
long long pos[N];
bool ok(long long u) {
  vector<long long> v;
  long long res = 0;
  long long troll = 0;
  memset(pos, 0, sizeof(pos));
  for (int i = 0; i < n; i++) {
    res += pos[i];
    if (a[i] + res < u) {
      long long x = u - (a[i] + res);
      pos[i + w] -= x;
      troll += x;
      res += x;
    }
  }
  return troll <= m;
}
int main() {
  scanf("%lld %lld %lld ", &n, &m, &w);
  long long res = (long long)1e9;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    res = min(res, a[i]);
  }
  long long l = res;
  long long r = 1e10;
  long long ans = res;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (ok(mid)) {
      ans = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  printf("%lld", ans);
  return 0;
}
