#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 5;
const int M = 5e3 + 5;
const int mod = 19650827;
const int INF = 0x3f3f3f3f;
deque<long long> due[N];
long long num[N];
long long h[N];
long long dp[N][M];
int main() {
  int n, k, m;
  cin >> n >> k >> m;
  for (int i = 1; i <= n; i++) {
    cin >> num[i];
  }
  if (k * m + (k - 1) < n) {
    cout << "-1" << endl;
  } else {
    dp[0][0] = 0;
    due[0].push_back(0);
    for (int i = 1; i <= n; i++) {
      for (int j = min(m, i); j >= 1; j--) {
        while (!due[j - 1].empty() && due[j - 1].front() < i - k) {
          due[j - 1].pop_front();
        }
        if (!due[j - 1].empty()) {
          dp[i][j] = dp[due[j - 1].front()][j - 1] + num[i];
          while (!due[j].empty() && dp[i][j] >= dp[due[j].back()][j]) {
            due[j].pop_back();
          }
          due[j].push_back(i);
        }
      }
    }
    long long ans = -1;
    for (int i = n; i > n - k; i--) {
      ans = max(ans, dp[i][m]);
    }
    cout << ans << endl;
  }
  return 0;
}
