#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3 + 5;
int readint() {
  int x = 0, f = 1;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    (s = getchar());
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + (s ^ 48);
    (s = getchar());
  }
  return x * f;
}
long long dp[maxn][maxn];
int a[maxn];
int q[maxn];
int main() {
  int n = readint(), k = readint(), x = readint();
  for (int i = 1; i <= n; i++) {
    a[i] = readint();
  }
  memset(dp, -0x3f, sizeof(dp));
  dp[0][0] = 0;
  for (int j = 1; j <= x; j++) {
    int head = 1, tail = 0;
    q[++tail] = 0;
    for (int i = 1; i <= n; i++) {
      while (head <= tail && i - q[head] > k) head++;
      dp[i][j] = dp[q[head]][j - 1] + a[i] + 0ll;
      while (head <= tail && dp[q[tail]][j - 1] <= dp[i][j - 1]) tail--;
      q[++tail] = i;
    }
  }
  long long ans = -1;
  for (int i = n; i >= n - k + 1; i--) {
    ans = max(ans, dp[i][x]);
  }
  cout << ans;
  return 0;
}
