#include <bits/stdc++.h>
using namespace std;
int k, x, n;
long long f[5001][5001] = {0};
long long a[5001] = {0};
deque<int> d[5001];
void update(int i) {
  for (int j = x; j > 1; j--) {
    while ((d[j - 1].size()) && (d[j - 1].front() < i - k))
      d[j - 1].pop_front();
    if (d[j - 1].size()) {
      f[i][j] = f[d[j - 1].front()][j - 1] + a[i];
      while ((d[j].size()) && (f[d[j].back()][j] <= f[i][j])) d[j].pop_back();
      d[j].push_back(i);
    }
  }
  if (i >= k) return;
  f[i][1] = a[i];
  while ((d[1].size()) && (f[d[1].back()][1] <= f[i][1])) d[1].pop_back();
  d[1].push_back(i);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> k >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) update(i);
  long long res = -1;
  for (int i = n - k; i < n; i++) {
    res = max(res, f[i][x]);
  }
  if (res != 0)
    cout << res;
  else
    cout << -1;
  return 0;
}
