#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, w;
  cin >> n >> m >> w;
  vector<long long> A(n);
  for (int x = 0; x < n; x++) cin >> A[x];
  long long low = 1, high = (long long)1e9 + m;
  long long ans = low, mid;
  while (high >= low) {
    mid = (low + high) / 2;
    long long left = 0;
    vector<long long> tmp(n + 1);
    long long add = 0;
    vector<long long> B = A;
    for (int x = 0; x < n; x++) {
      add += tmp[x];
      B[x] += add;
      if (B[x] < mid) {
        long long needed = mid - B[x];
        tmp[min(n, w + x)] -= needed;
        add += needed;
        left += needed;
      }
    }
    if (left <= m)
      ans = max(mid, ans), low = mid + 1;
    else
      high = mid - 1;
  }
  cout << ans << '\n';
}
