#include <bits/stdc++.h>
using namespace std;
long long a[5005], f[5005][5005], q[5005];
int n, k, x;
int main() {
  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) cin >> a[i];
  if (k * x + k - 1 < n) {
    printf("-1\n");
    return 0;
  }
  f[0][0] = 1;
  long long ans = 0;
  for (int j = 1; j <= x; j++) {
    int l = 1, r = 1;
    q[1] = j - 1;
    for (int i = j; i <= n; i++) {
      while (l <= r && q[l] + k < i) l++;
      if (l <= r && f[q[l]][j - 1] != 0) {
        f[i][j] = f[q[l]][j - 1] + a[i];
      }
      while (l <= r && f[q[r]][j - 1] <= f[i][j - 1]) r--;
      q[++r] = i;
      if (j == x && i + k > n) ans = max(ans, f[i][j]);
    }
  }
  cout << ans - 1 << endl;
}
