#include <bits/stdc++.h>
using namespace std;
const long long MXN = 5e3 + 10;
const long long INF = 1e18;
long long n, k, x, ans = -1;
long long A[MXN], dp[MXN][MXN];
deque<long long> dq[MXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < MXN; i++) {
    for (int j = 0; j < MXN; j++) {
      dp[i][j] = -INF;
    }
  }
  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) cin >> A[i];
  if (x < ceil(n / k)) return cout << -1, 0;
  dp[0][0] = 0;
  dq[0].push_back(0);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= x; j++) {
      while (!dq[j - 1].empty() && dq[j - 1].front() < i - k)
        dq[j - 1].pop_front();
    }
    for (int j = 1; j <= x; j++) {
      if (dq[j - 1].size()) {
        dp[i][j] = max(dp[i][j], A[i] + dp[dq[j - 1].front()][j - 1]);
      }
    }
    for (int j = 1; j <= x; j++) {
      while (!dq[j].empty() && dp[dq[j].back()][j] < dp[i][j]) {
        dq[j].pop_back();
      }
      dq[j].push_back(i);
    }
  }
  for (int i = 1; i <= k; i++) {
    ans = max(ans, dp[n - i + 1][x]);
  }
  cout << ans;
  return 0;
}
