#include <bits/stdc++.h>
using namespace std;
long long int flag[200000 + 2];
int main() {
  long long int n, m, w, l;
  cin >> n >> m >> w;
  l = m;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int x1 = 1, x2 = 1e16, s = 1, ans = 0;
  while (x1 <= x2) {
    s = 1;
    long long int t = (x1 + x2) / 2, add = 0;
    for (int i = 0; i < n; i++) {
      add -= flag[i];
      if (a[i] + add >= t) {
        flag[i] = 0;
        continue;
      } else {
        long long int p = t - a[i] - add;
        add += p;
        flag[i + w] = p;
        if (p > m) {
          s = 0;
        }
        m -= p;
      }
      flag[i] = 0;
    }
    add = 0;
    m = l;
    if (s) {
      ans = t;
      x1 = t + 1;
    } else {
      x2 = t - 1;
    }
  }
  cout << ans;
}
