#include <bits/stdc++.h>
using namespace std;
int n, k, x;
vector<long long> V;
long long MIN = -1e15;
class MaxQueue {
  stack<long long> maxin, stin, maxout, stout;

 public:
  MaxQueue() { maxin = maxout = stin = stout = stack<long long>(); }
  void push(long long val) {
    maxin.push(max(maxin.empty() ? MIN : maxin.top(), val));
    stin.push(val);
  }
  void pop() {
    if (maxout.empty()) {
      while (!maxin.empty()) {
        maxout.push(max(maxout.empty() ? MIN : maxout.top(), stin.top()));
        stout.push(stin.top());
        maxin.pop();
        stin.pop();
      }
    }
    maxout.pop();
    stout.pop();
  }
  long long getmax() {
    return max(maxin.empty() ? MIN : maxin.top(),
               maxout.empty() ? MIN : maxout.top());
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> x;
  int mn = n / k;
  if (x < mn) {
    cout << "-1\n";
    return 0;
  }
  V = vector<long long>(n);
  for (int i = 0; i < n; ++i) cin >> V[i];
  vector<vector<long long> > DP(x, vector<long long>(n, MIN));
  for (int i = 0; i < k; ++i) DP[0][i] = V[i];
  for (int i = 1; i < x; ++i) {
    MaxQueue mq;
    for (int j = 0; j < n; ++j) {
      long long v = mq.getmax();
      if (v >= 0)
        DP[i][j] = V[j] + v;
      else
        DP[i][j] = MIN;
      if (j >= k) mq.pop();
      mq.push(DP[i - 1][j]);
    }
  }
  long long mx = 0;
  for (int i = n - 1; i >= n - k; --i) {
    mx = max(mx, DP[x - 1][i]);
  }
  cout << mx << "\n";
  return 0;
}
