#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
const int N = 10005;
int n,w,s;
int a[N];
long long d[N],r[N];
deque<int> q;
int main(){
cin >> n >> w >> s;
for (int i=1;i<=n;++i){
cin >> a[i];
d[i] = -1e17;
r[i] = -1e17;
}
d[1] = 0;
for (int i=1;i<=n;++i){
for (int j=1;j<s;++j){
while (!q.empty() && d[q.back()]<=d[j]) q.pop_back();
q.push_back(j);
}
int p = min(w,i);
for (int j=1;j<=p;++j){
if (!q.empty() && j-1>q.front()) q.pop_front();
int k = j+s-1;
if (k<=w) {
while (!q.empty() && d[q.back()]<=d[k]) q.pop_back();
q.push_back(k);
}
r[j] = d[q.front()]+j*a[i];
}
while (!q.empty()) q.pop_back();
memcpy(d,r,sizeof(r));
}
long long ans = -1e17;
for (int i=1;i<=w;++i)
ans = max(ans,d[i]);
cout << ans << endl;
}