#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6 + 10;
const long long OO = 0x3f3f3f3f;
const double EPS = 1e-6;
const long long MOD = 1000000000;
struct MaxQueue {
  long long plus = 0;
  deque<pair<long long, long long>> dq;
  bool empty() { return dq.size() == 0; }
  void clear() {
    plus = 0;
    dq.clear();
  }
  void add(long long x) { plus += x; }
  long long max() { return dq.begin()->first + plus; }
  void push(long long x) {
    x -= plus;
    long long amt = 0;
    while (dq.size() and dq.back().first <= x)
      amt += dq.back().second + 1, dq.pop_back();
    dq.push_back({x, amt});
  }
  void pop() {
    if (dq.empty()) return;
    if (!dq.front().second)
      dq.pop_front();
    else
      dq.front().second--;
  }
};
long long n, k, x;
long long dp[5005][5005], arr[5005];
int32_t main() {
  scanf(" %lld", &n);
  scanf(" %lld", &k);
  scanf(" %lld", &x);
  for (long long i = 0; i < n; i++) scanf(" %lld", &arr[i + 1]);
  if ((n / k) > x) return puts("-1"), 0;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) dp[i][j] = -(1LL << 62LL);
  for (long long j = 1; j < x + 1; j++) {
    MaxQueue Q;
    dp[0][j] = 0;
    Q.push(0);
    for (long long i = 1; i < n + 1; i++) {
      dp[i][j] = Q.max() + arr[i];
      if (i >= k) Q.pop();
      Q.push(dp[i][j - 1]);
    }
  }
  long long ans = -(1LL << 62LL);
  for (long long i = 0; i < k; i++) ans = max(ans, dp[n - i][x]);
  if (ans <= 0) ans = -1;
  cout << ans << '\n';
  return 0;
}
