#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename T_container, typename T = typename enable_if<
                                    !is_same<T_container, string>::value,
                                    typename T_container::value_type>::type>
ostream &operator<<(ostream &os, const T_container &v) {
  os << '{';
  string sep;
  for (const T &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << "\n"; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
struct node {
  long long sum;
  node() { sum = -1; }
};
class segte {
 public:
  long long n{};
  vector<node> tree;
  vector<long long> a;
  node neutral;
  void init(long long N) {
    n = N;
    tree.resize(4 * n + 1);
    a.assign(n, -1);
  }
  void put(vector<long long> &val) { a = val; }
  void merge(node &curr, node &left, node &right) {
    curr.sum = max(left.sum, right.sum);
  }
  void single(node &curr, long long idx) { curr.sum = a[idx]; }
  void build(long long index, long long ss, long long se) {
    if (ss == se) {
      single(tree[index], ss);
      return;
    }
    long long mid = (ss + se) / 2;
    build(2 * index, ss, mid);
    build(2 * index + 1, mid + 1, se);
    merge(tree[index], tree[2 * index], tree[2 * index + 1]);
  }
  void build() { build(1, 0, n - 1); }
  node query(long long index, long long ss, long long se, long long qs,
             long long qe) {
    if (qs > se || qe < ss) return neutral;
    if (qs <= ss && qe >= se) return tree[index];
    long long mid = (ss + se) / 2;
    node left = query(2 * index, ss, mid, qs, qe);
    node right = query(2 * index + 1, mid + 1, se, qs, qe);
    node mer;
    merge(mer, left, right);
    return mer;
  }
  node query(long long l, long long r) { return query(1, 0, n - 1, l, r); }
  void update(long long index, long long idx, long long ss, long long se) {
    if (idx < ss || idx > se) return;
    if (ss == se) {
      single(tree[index], ss);
      return;
    }
    long long mid = (ss + se) / 2;
    update(2 * index, idx, ss, mid);
    update(2 * index + 1, idx, mid + 1, se);
    merge(tree[index], tree[2 * index], tree[2 * index + 1]);
  }
  void update(long long idx) { update(1, idx, 0, n - 1); }
};
void solve() {
  long long n, k, x;
  cin >> n >> k >> x;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long dp[n + 1][x + 1];
  segte second[x + 1];
  for (long long i = 0; i <= x; i++) {
    second[i].init(n + 1);
    second[i].build();
  }
  for (auto &c : dp) {
    for (auto &d : c) {
      d = -1;
    }
  }
  second[0].a[0] = 0;
  second[0].update(0);
  dp[0][0] = 0;
  long long ans = -1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= x; j++) {
      long long val = second[j - 1].query(max(i - k, (long long)0), i - 1).sum;
      if (val != -1) {
        dp[i][j] = max(dp[i][j], val + a[i - 1]);
        second[j].a[i] = max(second[j].a[i], dp[i][j]);
        second[j].update(i);
      }
    }
  }
  for (long long i = n; i > n - k; i--) {
    ans = max(ans, dp[i][x]);
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}
