#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MOD (int) 1e9 + 7
#define all(x) begin(x), end(x)
typedef long long ll;
using namespace std;
template <typename T> // cin >> vector<T>
istream &operator>>(istream &istream, vector<T> &v) {
for (auto &it : v)
cin >> it;
return istream;
}
template <typename T> // cout << vector<T>
ostream &operator<<(ostream &ostream, const vector<T> &c) {
for (auto &it : c)
cout << it << " ";
return ostream;
}
void solve(void)
{
int n, x, y; cin >> n >> x >> y;
vector<int> a(n); cin >> a;
int ans = INT_MAX;
for(int i = 0; i < y; i++) {
int days = 1, j = i, cost = 0, start = i;
while(j < n && days <= x) {
cost += a[j];
j += y;
days++;
}
j -= y;
if(days != x + 1) continue;
ans = min(ans, cost);
while(j + y < n) {
cost -= a[start];
cost += a[j + y];
ans = min(ans, cost);
j += y;
start += y;
}
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}