#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 5e3 + 10, INF = 1e13 + 10;
long long n, k, x, a[MAXN], dp[MAXN][MAXN], ans = -INF;
int main() {
  cin >> n >> k >> x;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 0; i <= n; ++i)
    for (long long t = 0; t <= x; ++t) dp[i][t] = -INF;
  dp[0][0] = 0;
  for (long long t = 1; t <= x; ++t) {
    deque<long long> q;
    q.push_back(0);
    for (long long i = 1; i <= n; ++i) {
      if (!q.empty()) dp[i][t] = dp[q.front()][t - 1] + a[i];
      if (q.front() <= i - k) q.pop_front();
      while (!q.empty() && dp[q.back()][t - 1] <= dp[i][t - 1]) q.pop_back();
      q.push_back(i);
    }
  }
  for (long long i = n - k + 1; i <= n; ++i) {
    ans = max(ans, dp[i][x]);
  }
  if (ans < 0)
    cout << "-1";
  else
    cout << ans;
  return 0;
}
