#include <bits/stdc++.h>
using namespace std;
long long int cons;
inline long long int check(long long int a) {
  if (a >= cons) a %= cons;
  return a;
}
inline long long int check2(long long int a) {
  a %= cons;
  if (a < 0) a += cons;
  return a;
}
inline long long int fast_check(long long int a) {
  if (a >= cons) a -= cons;
  return a;
}
long long int GCD(long long int a, long long int b) {
  while (a && b) {
    a = a % b;
    if (a != 0) b = b % a;
  }
  return a + b;
}
long long int exp(long long int a, long long int n) {
  long long int ans = 1;
  a = check(a);
  while (n) {
    if (n & 1) ans = check(ans * a);
    a = check(a * a);
    n = (n >> 1);
  }
  return ans;
}
void print_pair(pair<int, int> p) {
  cout << p.first << " " << p.second << endl;
}
long long int nc2(long long int a) { return (a * (a - 1)) / 2; }
long long int nc3(long long int a) {
  long long int b = a * (a - 1) * (a - 2);
  return b / 6;
}
const int N = 5050;
long long int dp1[N], dp2[N];
long long int arr[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cons = 1e9 + 7;
  srand(time(NULL));
  int n, k, first;
  cin >> n >> k >> first;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  dp1[0] = -1;
  dp2[0] = -1;
  for (int i = 1; i <= n; i++) {
    if (i <= k)
      dp1[i] = arr[i];
    else
      dp1[i] = -1;
    dp2[i] = -1;
  }
  for (int i = 2; i <= first; i++) {
    deque<int> deq;
    deq.push_back(0);
    for (int j = 1; j <= n; j++) {
      if (j - deq.front() > k) deq.pop_front();
      int ind = deq.front();
      if (dp1[ind] == -1)
        dp2[j] = -1;
      else
        dp2[j] = arr[j] + dp1[ind];
      while (!deq.empty() && dp1[deq.back()] <= dp1[j]) deq.pop_back();
      deq.push_back(j);
    }
    for (int j = 1; j <= n; j++) {
      dp1[j] = dp2[j];
      dp2[j] = -1;
    }
  }
  long long int ans = -1;
  for (int i = n; i > n - k; i--) ans = max(ans, dp1[i]);
  cout << ans;
  return 0;
}
