#include <bits/stdc++.h>usingnamespacestd;
constint maxn = 200000 + 5;
constint INF = (1<<30) - 1;
int h[maxn], d[maxn];
int n, m, w;
bool judge(int x)
{
memset(d, 0, sizeof(d));
int sum = 0;
int cnt = 0;
for(int i = 0; i < n; i++) {
sum += d[i];
int t = x - h[i] - sum;
if(t > 0) {
cnt += t;
sum += t;
d[i] += t;
d[i+w] -= t;
if(cnt > m) returnfalse;
}
}
returntrue;
}
int main()
{
scanf("%d%d%d", &n, &m, &w);
for(int i = 0; i < n; i++) {
scanf("%d", &h[i]);
}
int l = 0, r = INF;
while(l < r - 1) {
int m = (l + r) >> 1;
if(!judge(m)){
r = m;
} else {
l = m;
}
}
cout << l << endl;
return0;
}