#include <bits/stdc++.h>
using namespace std;
long long a[100001];
long long t[100001];
int n, m, w;
int main() {
  while (cin >> n >> m >> w) {
    for (int i = 0, _i = (n); i < _i; ++i) {
      cin >> a[i];
    }
    long long l = 0, u = 2000000000LL;
    while (l < u) {
      long long h = (l + u) / 2;
      memset(t, 0, sizeof(long long) * n);
      long long dl = 0;
      long long days = 0;
      for (int i = 0, _i = (n); i < _i; ++i) {
        dl -= t[i];
        long long cur = h - a[i] - dl;
        if (cur > 0) {
          days += cur;
          dl += cur;
          if (i + w < n) t[i + w] += cur;
        }
      }
      if (days > m)
        u = h;
      else
        l = h + 1;
    }
    cout << l - 1 << "\n";
  }
  return 0;
}
