#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long arr[N], dp[N], mn, d;
int n, w;
int f(long long x) {
  long long dia = d, izq = 0;
  for (int i = 0; i < n; i++) {
    if (i >= w) izq -= dp[i - w];
    dp[i] = max(x - arr[i] - izq, 0ll);
    izq += dp[i];
    dia -= dp[i];
    if (dia < 0) return 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  ;
  mn = 1e9 + 7;
  cin >> n >> d >> w;
  for (int i = 0; i < n; i++) cin >> arr[i], mn = min(mn, arr[i]);
  long long l = mn, r = mn + d + 1, m;
  while (1 < r - l) {
    m = (r + l) / 2;
    if (f(m))
      r = m;
    else
      l = m;
  }
  cout << l << '\n';
  return 0;
}
