#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9 + 7;
const int N = (int)5e3 + 7;
int n, K, x;
int a[N];
long long dp[N][N];
deque<pair<long long, int> > Q;
void Clear() { Q.clear(); }
void Push(long long val, int id) {
  while (!Q.empty() && Q.back().first < val) Q.pop_back();
  Q.push_back(make_pair(val, id));
}
long long Front(int id) {
  while (!Q.empty() && id - Q.front().second > K) Q.pop_front();
  return Q.front().first;
}
void Init() {
  memset(dp, 0xc0, sizeof(dp));
  for (int i = (1); i < (n + 1); ++i) scanf("%d", a + i);
  a[n + 1] = 0;
}
int Solve() {
  dp[0][0] = 0;
  for (int j = (1); j < (x + 2); ++j) {
    Clear();
    for (int i = (0); i < (j); ++i) Push(dp[i][j - 1], i);
    for (int i = (j); i < (n + 2); ++i) {
      dp[i][j] = Front(i) + a[i];
      Push(dp[i][j - 1], i);
    }
  }
  return printf("%lld\n", dp[n + 1][x + 1] >= 0 ? dp[n + 1][x + 1] : -1);
}
int main() {
  while (~scanf("%d%d%d", &n, &K, &x)) {
    Init();
    Solve();
  }
  return 0;
}
