#include <bits/stdc++.h>
using namespace std;
long long int N = 1e9 + 7;
long long int n, m, w;
vector<long long int> a(1e5 + 4);
long long int l = 0, r = 1e10, mid;
bool isPossible(long long int mid) {
  vector<long long int> ops(1e5 + 4);
  long long int curr = 0, tot = 0;
  for (long long int i = 0; i < n; i++) {
    if (i - w >= 0) {
      curr -= ops[i - w];
    }
    if (a[i] + curr < mid) {
      ops[i] = mid - (a[i] + curr);
      curr += ops[i];
      tot += ops[i];
    }
  }
  if (tot > m) {
    return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> w;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (l < r) {
    mid = (l + r) / 2;
    if (isPossible(mid)) {
      if (l == mid) {
        break;
      }
      l = mid;
    } else {
      r = mid - 1;
    }
  }
  if (isPossible(r)) {
    cout << r << endl;
  } else {
    cout << l << endl;
  }
}
