#include <bits/stdc++.h>
using namespace std;
const long long int MAXN = 5e3 + 5;
const long long int INF = 1e18;
long long int dp[MAXN][MAXN];
long long int a[MAXN];
void solve() {
  long long int n, k, x;
  cin >> n >> k >> x;
  for (long long int i = 0; i < n; ++i) cin >> a[i];
  for (long long int i = 0; i <= n; ++i) dp[i][0] = -INF;
  dp[0][0] = 0;
  for (long long int s = 1; s <= x; ++s) {
    deque<pair<long long int, long long int>> que;
    que.push_back({0, 0});
    for (long long int i = 1; i <= n; ++i) {
      while ((!que.empty()) && (que.front().second < i - k)) que.pop_front();
      if (!que.empty())
        dp[i][s] = que.front().first + a[i - 1];
      else
        dp[i][s] = -INF;
      long long int offer = dp[i][s - 1];
      while ((!que.empty()) && (que.back().first <= offer)) que.pop_back();
      que.push_back({offer, i});
    }
  }
  long long int res = -INF;
  for (long long int i = n; i > n - k; --i) res = max(res, dp[i][x]);
  if (res < 0)
    cout << -1 << '\n';
  else
    cout << res << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int T = 1;
  for (long long int i = 1; i <= T; ++i) {
    solve();
  }
  return 0;
}
