#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 7;
const long long INF = 1e18;
long long DP[N][N];
deque<pair<int, long long> > Q[N];
int n, k, x;
long long Get(int cnt, int pos) {
  long long result = -INF;
  while (!Q[cnt].empty() && Q[cnt].front().first < pos - k) Q[cnt].pop_front();
  if (!Q[cnt].empty()) result = Q[cnt].front().second;
  return result;
}
void Add(int i, int j) {
  long long value = DP[i][j];
  while (!Q[j].empty() && (Q[j].back().second <= value)) Q[j].pop_back();
  Q[j].push_back({i, value});
}
int main() {
  scanf("%d %d %d", &n, &k, &x);
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= x; ++j) DP[i][j] = -INF;
  DP[0][0] = 0LL;
  Q[0].push_back({0, 0});
  for (int i = 1; i <= n; ++i) {
    long long a;
    scanf("%lld", &a);
    for (int j = 1; j <= x; ++j) DP[i][j] = max(DP[i][j], a + Get(j - 1, i));
    for (int j = 1; j <= x; ++j) Add(i, j);
  }
  long long result = -INF;
  for (int i = n - k + 1; i <= n; ++i) result = max(result, DP[i][x]);
  if (result < 0LL)
    printf("-1");
  else
    printf("%lld", result);
  return 0;
}
