#include <bits/stdc++.h>
using namespace std;
struct myqueue {
  stack<pair<long long, long long> > s1, s2;
  long long size() { return s1.size() + s2.size(); }
  bool empty() { return size() == 0; }
  long long getmax() {
    if (empty()) return -1;
    if (!s1.empty() && !s2.empty())
      return max(s1.top().second, s2.top().second);
    if (!s1.empty()) return s1.top().second;
    return s2.top().second;
  }
  void push(long long val) {
    if (s2.empty())
      s2.push(make_pair(val, val));
    else
      s2.push(make_pair(val, max(val, s2.top().second)));
  }
  void pop() {
    if (s1.empty()) {
      while (!s2.empty()) {
        if (s1.empty())
          s1.push(make_pair(s2.top().first, s2.top().first));
        else
          s1.push(
              make_pair(s2.top().first, max(s2.top().first, s1.top().second)));
        s2.pop();
      }
    }
    s1.pop();
  }
};
long long n, k, xx, a[5005], dp[5005][5005];
int main(int argc, char const *argv[]) {
  cin >> n >> k >> xx;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  myqueue q[5005];
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  dp[0][1] = a[0];
  q[0].push(0);
  q[1].push(a[0]);
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j >= 1; --j) {
      long long minl = ((i + 1) / k) + (((i + 1) % k) > 0), cans;
      if (j < minl)
        cans = -1;
      else {
        long long cv = q[j - 1].getmax();
        if (cv >= 0)
          cans = a[i] + cv;
        else
          cans = -1;
      }
      dp[i][j] = cans;
      q[j].push(cans);
    }
    for (int j = 1; j <= i + 1; ++j) {
      if (q[j].size() > k) q[j].pop();
    }
  }
  long long ans = -1;
  for (int i = n - k; i < n; ++i) {
    ans = max(ans, dp[i][xx]);
  }
  cout << ans;
  return 0;
}
