#include <bits/stdc++.h>
using namespace std;
long long mem[5003][5003], ara[5003];
int main() {
  int n, k, x;
  scanf("%d %d %d", &n, &k, &x);
  for (int i = 1; i <= n; i++) scanf("%lld", &ara[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= x; j++) mem[i][j] = -1e17;
  for (int i = 1; i <= x; i++) {
    deque<pair<long long, long long> > dq;
    dq.push_back({0, n + 1});
    for (int j = n; j >= 1; j--) {
      while (!dq.empty() && dq.back().second - k > j) dq.pop_back();
      mem[j][i] = max(mem[j][i], ara[j] + dq.back().first);
      pair<long long, long long> p = make_pair(mem[j][i - 1], j);
      while (!dq.empty() && dq.front().first <= p.first) dq.pop_front();
      dq.push_front(p);
    }
  }
  long long res = -1;
  for (int i = 1; i <= k; i++) res = max(res, mem[i][x]);
  printf("%lld\n", res);
  return 0;
}
