#include <bits/stdc++.h>
using namespace std;
struct qmax {
  deque<pair<long long, int> > q;
  void push(long long x) {
    int t = 1;
    while (!q.empty() && q.back().first <= x)
      t += q.back().second, q.pop_back();
    q.push_back({x, t});
  }
  void pop() {
    if (!(--q.front().second)) q.pop_front();
  }
  long long max() { return q.front().first; }
};
const long long MAXN = 5010, INF = 1e15;
long long a[MAXN], dp[MAXN][MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, x, k;
  cin >> n >> k >> x;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) cin >> a[i];
  fill(dp[0], dp[0] + MAXN, -INF);
  for (int i = 1, ThxDem = x + 1; i < ThxDem; ++i) {
    qmax q;
    q.push(0);
    for (int pos = 0, ThxDem = n; pos < ThxDem; ++pos) {
      if (pos >= k) q.pop();
      dp[i][pos] = a[pos] + q.max();
      q.push(dp[i - 1][pos]);
    }
  }
  long long res = -1;
  for (int i = n - k, ThxDem = n; i < ThxDem; ++i) res = max(res, dp[x][i]);
  cout << res << endl;
}
