#include <bits/stdc++.h>
using namespace std;
const long long N = 5005;
const long long inf = 1e15 + 1;
priority_queue<pair<long long, long long> > checker[N];
long long dp[N][N], ar[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, k, x, i, j, l, ans = 0;
  cin >> n >> k >> x;
  for (i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  if (x * k + k - 1 < n) {
    cout << -1;
    return 0;
  }
  if (k == 1) {
    long long sum = 0;
    for (i = 1; i <= n; i++) {
      sum += ar[i];
    }
    cout << sum;
    return 0;
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= x; j++) {
      dp[i][j] = -inf;
    }
  }
  dp[0][0] = 0;
  checker[1].push({0, 0});
  for (i = 1; i <= n; i++) {
    for (j = max(i / k, 1ll); j <= min(x, i); j++) {
      if (dp[i - 1][j - 1] != -inf) {
        checker[j].push({dp[i - 1][j - 1], i - 1});
      }
      while (checker[j].size() != 0) {
        if (checker[j].top().second >= i - k && checker[j].top().second < i) {
          dp[i][j] = checker[j].top().first + ar[i];
          break;
        }
        checker[j].pop();
      }
    }
  }
  for (i = max(max(n - k + 1, 1ll), x); i <= n; i++) {
    if (dp[i][x] > ans) {
      ans = dp[i][x];
    }
  }
  cout << ans;
}
