#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  long long f = 0, c = getchar();
  x = 0;
  while (!isdigit(c)) f |= c == 45, c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (f) x = -x;
}
template <typename T, typename... Args>
inline void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
const long long maxn = 5050;
long long n, m, K;
long long a[maxn], f[maxn][maxn];
deque<long long> q;
signed main() {
  read(n, K, m);
  for (long long i = 1; i <= n; i++) read(a[i]);
  memset(f, -0x3f, sizeof(f));
  f[0][0] = 0;
  for (long long j = 1; j <= m; j++) {
    while (!q.empty()) q.pop_back();
    for (long long i = 0; i < j; i++) {
      while (!q.empty() && f[q.back()][j - 1] <= f[i][j - 1]) q.pop_back();
      q.push_back(i);
    }
    for (long long i = j; i <= n; i++) {
      while (!q.empty() && i - q.front() + 1 > K + 1) q.pop_front();
      if (!q.empty()) {
        long long k = q.front();
        f[i][j] = max(f[i][j], f[k][j - 1] + a[i]);
      }
      while (!q.empty() && f[i][j - 1] >= f[q.back()][j - 1]) q.pop_back();
      q.push_back(i);
    }
  }
  long long ans = 0;
  for (long long i = n - K + 1; i <= n; i++) ans = max(ans, f[i][m]);
  if (ans == 0) ans = -1;
  cout << ans;
  return 0;
}
