#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
long long f[N][N];
struct ii {
  long long v, p;
};
deque<ii> q[N];
void diss(long long v, long long p, int k) {
  while (!q[k].empty() && v >= q[k].back().v) q[k].pop_back();
  q[k].push_back({v, p});
}
long long a[N];
int main() {
  int n, k, x;
  cin >> n >> k >> x;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  int v;
  memset(f, -1, sizeof f);
  f[0][0] = 0;
  diss(f[0][0], 0, 0);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= x; ++j) {
      while (q[j - 1].size() && q[j - 1].front().p < i - k)
        q[j - 1].pop_front();
      if (q[j - 1].size()) f[i][j] = q[j - 1].front().v + a[i];
    }
    for (int j = 1; j <= x; ++j)
      if (f[i][j] > 0) diss(f[i][j], i, j);
  }
  long long ans = -1;
  for (int i = n; n - i < k; --i)
    if (f[i][x] > 0) ans = max(ans, f[i][x]);
  cout << ans;
  return 0;
}
