#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 5007;
void add(long long i, deque<long long> &q, long long *a) {
  if (a[i] == -1) return;
  while (q.size() && a[q.back()] < a[i]) q.pop_back();
  q.push_back(i);
}
void del(long long i, deque<long long> &q, long long *a) {
  if (q.size() && q.front() == i) q.pop_front();
}
long long get(deque<long long> &q, long long *a) {
  if (q.empty())
    return -1;
  else
    return a[q.front()];
}
long long a[MAXN];
long long dp[MAXN][MAXN];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 0; i < MAXN; ++i)
    for (long long j = 0; j < MAXN; ++j) dp[i][j] = -1;
  long long n, k, w;
  cin >> n >> k >> w;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  if (k == 1) {
    if (w == n) {
      long long ans = 0;
      for (long long i = 0; i < n; ++i) ans += a[i];
      cout << ans << '\n';
    } else {
      cout << "-1\n";
    }
    exit(0);
  }
  for (long long i = 0; i < k; ++i) {
    dp[1][i] = a[i];
  }
  for (long long i = 2; i <= w; ++i) {
    deque<long long> q;
    for (long long j = 0; j < n; ++j) {
      if (j - k - 1 >= 0) del(j - k - 1, q, dp[i - 1]);
      if (j - 1 >= 0) add(j - 1, q, dp[i - 1]);
      long long best = get(q, dp[i - 1]);
      if (best == -1)
        dp[i][j] = -1;
      else
        dp[i][j] = best + a[j];
    }
  }
  long long ans = -1;
  for (long long i = 0; i < n; ++i) {
    if (n - i - 1 >= k) continue;
    ans = max(ans, dp[w][i]);
  }
  cout << ans << '\n';
  return 0;
}
