#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3 + 10;
int n, m, k, l, r;
int a[maxn];
long long ans;
long long f[maxn][maxn], q[maxn];
int main() {
  scanf("%d%d%d", &n, &k, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j < maxn; j++) f[i][j] = -1;
  f[0][0] = 0;
  for (int j = 1; j <= m; j++) {
    l = 1, r = 0;
    memset(q, 0, sizeof(q));
    for (int i = 1; i <= n; i++) {
      while (l <= r && q[r] < f[i - 1][j - 1]) r--;
      q[++r] = f[i - 1][j - 1];
      if (i > k && q[l] == f[i - k - 1][j - 1]) l++;
      if (i >= j && q[l] != -1) f[i][j] = q[l] + a[i];
    }
  }
  ans = -1;
  for (int i = n - k + 1; i <= n; i++) {
    ans = max(ans, f[i][m]);
  }
  printf("%lld", ans);
  return 0;
}
