#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 5;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
const long long inf = 0x3f3f3f3f;
typedef pair<long long, long long> P;
long long n, k, x;
long long a[5005];
deque<P> que[5005];
long long dp[5005][5005];
void solve() {
  memset(dp, -1 * inf, sizeof(dp));
  dp[0][0] = 0;
  que[0].push_back(P(0, 0));
  long long ans = -1;
  for (long long i = 1; i <= n; i++) {
    long long pos = max(i - k, 0ll);
    for (long long j = 1; j <= x; j++) {
      while (!que[j - 1].empty() && que[j - 1].front().first < pos) {
        que[j - 1].pop_front();
      }
    }
    for (long long j = 1; j <= x; j++) {
      if (!que[j - 1].empty()) {
        long long p = que[j - 1].front().first;
        long long val = que[j - 1].front().second;
        dp[i][j] = max(dp[i][j], dp[p][j - 1] + a[i]);
      }
    }
    for (long long j = 1; j <= x; j++) {
      while (!que[j].empty() && dp[i][j] >= que[j].back().second)
        que[j].pop_back();
      if (dp[i][j] > 0) que[j].push_back(P(i, dp[i][j]));
      if (i > n - k) ans = max(ans, dp[i][j]);
    }
  }
  printf("%lld\n", ans);
}
int main() {
  cin >> n >> k >> x;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  solve();
  return 0;
}
