#include <bits/stdc++.h>
using namespace std;
void dota47() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
const long long MAX_N = 5e3 + 1;
long long dp[MAX_N][MAX_N], n, k, x, a[MAX_N];
map<long long, map<long long, long long>> t;
void upd(long long v, long long tl, long long tr, long long pos, long long val,
         long long id) {
  if (tl == tr)
    t[id][v] = val;
  else {
    long long tm = (tl + tr) >> 1;
    if (tm >= pos)
      upd(v * 2, tl, tm, pos, val, id);
    else
      upd(v * 2 + 1, tm + 1, tr, pos, val, id);
    long long v1 = (t[id].count(v * 2) ? t[id][v * 2] : -1e18);
    long long v2 = (t[id].count(v * 2 + 1) ? t[id][v * 2 + 1] : -1e18);
    t[id][v] = max(v1, v2);
  }
}
long long get_mx(long long v, long long tl, long long tr, long long l,
                 long long r, long long id) {
  if (tl > r || tr < l || t[id].count(v) == 0) return -1e18;
  if (tl >= l && tr <= r) return t[id][v];
  long long tm = (tl + tr) >> 1;
  return max(get_mx(v * 2, tl, tm, l, r, id),
             get_mx(v * 2 + 1, tm + 1, tr, l, r, id));
}
signed main() {
  dota47();
  fill(&dp[0][0], &dp[0][0] + MAX_N * MAX_N, -1e18);
  cin >> n >> k >> x;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long first = 1; first <= k; first++)
    dp[first][1] = a[first], upd(1, 1, n, first, a[first], 1);
  for (long long i = 2; i <= n; i++) {
    for (long long now = 2; now <= x; now++) {
      dp[i][now] = max(dp[i][now],
                       get_mx(1, 1, n, max(1ll, i - k), i - 1, now - 1) + a[i]);
      upd(1, 1, n, i, dp[i][now], now);
    }
  }
  long long best = 0;
  for (long long i = n - k + 1; i <= n; i++) best = max(best, dp[i][x]);
  if (best == 0)
    cout << -1;
  else
    cout << best;
  return 0;
}
