#include <bits/stdc++.h>
using namespace std;
void load() {}
const int N = 5012;
int a[N];
long long dp[N][N];
void trungtt() {
  int n, k, x;
  scanf("%d%d%d", &n, &k, &x);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i <= x; ++i)
    for (int j = 0; j <= n; ++j) dp[i][j] = -1e18;
  dp[0][0] = 0;
  for (int i = 1; i <= x; ++i) {
    deque<int> q;
    q.push_back(0);
    for (int j = 1; j <= n; ++j) {
      dp[i][j] = dp[i - 1][q.front()] + a[j];
      while (!q.empty() && dp[i - 1][q.back()] <= dp[i - 1][j]) q.pop_back();
      q.push_back(j);
      if (j - q.front() >= k) q.pop_front();
    }
  }
  long long ans = -1e18;
  for (int i = n; i > n - k; --i) ans = max(ans, dp[x][i]);
  if (ans < 0) ans = -1;
  printf("%lld", ans);
}
int main() {
  load();
  trungtt();
  return 0;
}
