#include <bits/stdc++.h>
using namespace std;
int n, k, x;
long long f[5005][5005];
int q[5005];
int le = 1, ri = 0;
int a[5005];
int main() {
  scanf("%d%d%d", &n, &k, &x);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(f, 0xcf, sizeof f);
  if (n / k > x) {
    puts("-1");
    return 0;
  }
  f[0][0] = 0;
  for (int j = 1; j <= x; j++) {
    le = 1, ri = 0;
    q[++ri] = 0;
    for (int i = 1; i <= n; i++) {
      while (le <= ri && q[le] + k < i) le++;
      if (le <= ri) f[i][j] = f[q[le]][j - 1] + a[i];
      while (le <= ri && f[i][j - 1] >= f[q[ri]][j - 1]) ri--;
      q[++ri] = i;
    }
  }
  long long ans = 0;
  for (int i = n - k + 1; i <= n; i++) ans = max(ans, f[i][x]);
  printf("%lld\n", ans);
  return 0;
}
