#include <bits/stdc++.h>
using namespace std;
const long long MIN = numeric_limits<long long>::min();
class WindowHeap {
 public:
  WindowHeap() {}
  long long top() {
    if (_i >= _h.size()) return MIN;
    return _h[_i].first;
  }
  void erase(int idx) {
    if (!_h.empty() && _h[_i].second == idx) ++_i;
  }
  void insert(long long val, int idx) {
    if (val == MIN) return;
    while (!_h.empty() && val > _h.rbegin()->first) _h.pop_back();
    if (_h.empty() || val < _h.rbegin()->first)
      _h.emplace_back(val, idx);
    else
      _h.rbegin()->second = idx;
    if (_i >= _h.size()) _i = _h.size() - 1;
  }

 private:
  vector<pair<long long, int>> _h;
  size_t _i;
};
int main() {
  int n, k, x;
  cin >> n >> k >> x;
  vector<int> a(n);
  for (int& ai : a) cin >> ai;
  vector<long long> dp(n + 1, MIN);
  dp[0] = 0;
  for (int xi = 0; xi < x; ++xi) {
    WindowHeap wh;
    for (int i = n - 1; i > max(n - k, -1); --i) {
      wh.insert(dp[i], i);
    }
    for (int i = n; i > xi; --i) {
      if (i - k >= 0) wh.insert(dp[i - k], i - k);
      long long p = wh.top();
      if (p > MIN) dp[i] = p + a[i - 1];
      wh.erase(i - 1);
    }
    dp[xi] = MIN;
  }
  long long best = -1;
  for (int i = n; i > n - k; --i) best = max(best, dp[i]);
  cout << best << endl;
  return 0;
}
