#include <bits/stdc++.h>
using namespace std;
int n, k, x;
const int N = 5090;
deque<pair<long long, long long> > q;
long long dp[N][N];
long long a[N];
long long z = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n + 3; i++) {
    for (int j = 0; j < x + 10; j++) dp[i][j] = -1e14;
  }
  for (int i = 0; i < n; i++) dp[i][1] = a[i];
  long long re = 0;
  for (int i = 1; i <= x; i++) {
    for (int j = 0; j < n; j++) {
      long long mx = -1e15;
      while (q.size() && q.front().second < j - k) q.pop_front();
      if (q.size()) mx = q.front().first;
      if (j < k) mx = max(mx, z);
      dp[j][i] = mx + a[j];
      while (q.size() && q.back().first < dp[j][i - 1]) {
        q.pop_back();
      }
      q.push_back({dp[j][i - 1], j});
    }
    q.clear();
  }
  re = -1e15;
  for (int i = n - k; i < n; i++) re = max(re, dp[i][x]);
  if (re < 0)
    cout << -1;
  else
    cout << re;
}
