#include <bits/stdc++.h>
using namespace std;
long long dp[5005][5005];
int main() {
  int n, k, first;
  scanf("%d %d %d", &n, &k, &first);
  memset(dp, 0, sizeof(dp));
  int a[5005];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  deque<pair<long long, long long> > q[5005];
  q[0].push_back(make_pair((0), (0)));
  for (int i = 1; i <= n; i++) {
    dp[i][0] = -1e18;
    for (int j = 1; j <= i; j++) {
      if (q[j - 1].front().first < i - k) q[j - 1].pop_front();
      assert(q[j - 1].size());
      dp[i][j] = q[j - 1].front().second + a[i];
    }
    for (int j = 0; j <= i; j++) {
      while (!q[j].empty() && dp[i][j] >= q[j].back().second) q[j].pop_back();
      q[j].push_back(make_pair((i), (dp[i][j])));
    }
  }
  long long ans = -1;
  for (int i = n - k + 1; i <= n; i++) ans = max(ans, dp[i][first]);
  printf("%lld\n", ans);
}
