#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int N = 5e3 + 5;
const long long int mod = 1e9 + 7;
const long long int inf = 1e18 + 9;
long long int a[N], dp[N][N];
deque<long long int> q[N], r[N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, k, x;
  cin >> n >> k >> x;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  for (long long int i = 0; i <= n; i++) {
    q[i].push_back(0);
    for (long long int j = 0; j <= n; j++) dp[i][j] = -inf;
  }
  long long int ans = 0;
  for (long long int i = 1; i <= n; i++) {
    if (i <= k) dp[i][1] = a[i];
    for (long long int j = 2; j <= i; j++) {
      while (!q[j - 1].empty() && q[j - 1].front() < i - k)
        q[j - 1].pop_front();
      if (!q[j - 1].empty()) dp[i][j] = a[i] + dp[q[j - 1].front()][j - 1];
    }
    for (long long int j = 1; j <= i; j++) {
      while (!q[j].empty() && dp[q[j].back()][j] <= dp[i][j]) q[j].pop_back();
      q[j].push_back(i);
    }
  }
  for (long long int i = 1; i <= k; i++) ans = max(ans, dp[n - i + 1][x]);
  if (ans <= 0)
    cout << -1;
  else
    cout << ans;
  return 0;
}
