#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5e3 + 10, inf = 1e15 + 7;
long long tree[4 * maxn];
long long dp[maxn][maxn], a[maxn];
long long query(long long at, long long L, long long R, long long l,
                long long r) {
  if (L > r || R < l) return -inf;
  if (L >= l && R <= r) return tree[at];
  long long mid = L + R >> 1;
  return max(query(at << 1, L, mid, l, r),
             query(at << 1 | 1, mid + 1, R, l, r));
}
void update(long long at, long long L, long long R, long long idx,
            long long v) {
  if (L == R) return void(tree[at] = v);
  long long mid = L + R >> 1;
  if (idx <= mid)
    update(at << 1, L, mid, idx, v);
  else
    update(at << 1 | 1, mid + 1, R, idx, v);
  tree[at] = max(tree[at << 1], tree[at << 1 | 1]);
}
int main() {
  long long n, k, X;
  cin >> n >> k >> X;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 0;
  for (long long i = 1; i <= n; i++) dp[i][0] = -inf;
  deque<pair<long long, long long>> dq;
  for (long long x = 1; x <= X; x++) {
    for (long long i = 1; i <= n; i++) {
      while (!dq.empty() && dq.back().first <= dp[i - 1][x - 1]) dq.pop_back();
      dq.push_back({dp[i - 1][x - 1], i - 1});
      while (!dq.empty() && dq.front().second + k < i) dq.pop_front();
      dp[i][x] = dq.front().first + a[i];
    }
    dq.clear();
  }
  long long mx = 0;
  for (long long i = n - k + 1; i <= n; i++) mx = max(mx, dp[i][X]);
  if (mx)
    cout << mx << endl;
  else
    cout << -1 << endl;
  return 0;
}
