#include <bits/stdc++.h>
using namespace std;
long long a[5020], f[5020][5020];
deque<int> d[5020];
int main(void) {
  int n, k, x;
  int i, j;
  long long o;
  scanf("%d %d %d", &n, &k, &x);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  memset(f, -1, sizeof f);
  for (i = 1; i <= n; i++) {
    for (j = 1; j < x; j++)
      for (; !d[j].empty() && d[j].front() + k < i; d[j].pop_front())
        ;
    for (j = 2; j <= x && j <= i; j++)
      if (!d[j - 1].empty()) f[i][j] = f[d[j - 1].front()][j - 1] + a[i];
    for (j = 2; j <= x && j <= i; j++)
      if (f[i][j] != -1) {
        for (; !d[j].empty() && f[d[j].back()][j] <= f[i][j]; d[j].pop_back())
          ;
        d[j].push_back(i);
      }
    if (i <= k) {
      f[i][1] = a[i];
      for (; !d[1].empty() && f[d[1].back()][1] <= a[i]; d[1].pop_back())
        ;
      d[1].push_back(i);
    }
  }
  for (i = n - k + 1, o = -1; i <= n; i++) o = max(o, f[i][x]);
  printf("%I64d\n", o);
  return 0;
}
