#include <bits/stdc++.h>
using namespace std;
template <class T, class T1>
int chkmax(T &x, const T1 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T1>
int chkmin(T &x, const T1 &y) {
  return x > y ? x = y, 1 : 0;
}
const int MAXN = (int)5e3 + 42;
const int64_t inf = (int64_t)1e18;
template <class T>
struct monotonous_queue_max {
  int len, current_position;
  deque<pair<T, int> > Q;
  monotonous_queue_max() {
    Q.clear();
    current_position = 0;
    len = 0;
  }
  void init(int _l) {
    len = _l;
    current_position = 0;
    Q.clear();
  }
  void push_back(T x) {
    while (!Q.empty() && current_position - Q.front().second >= len)
      Q.pop_front();
    while (!Q.empty() && x >= Q.back().first) Q.pop_back();
    Q.push_back({x, current_position++});
  }
  T query() {
    if (Q.empty()) return -(T)inf;
    return Q.front().first;
  }
};
int n, x, k;
int a[MAXN];
void read() {
  cin >> n >> x >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
}
int64_t dp[MAXN][MAXN];
monotonous_queue_max<int64_t> q[MAXN];
void solve() {
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= k; j++) dp[i][j] = -inf;
  for (int i = 0; i <= k; i++) q[i].init(x);
  dp[0][0] = 0;
  q[0].push_back(0);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) dp[i][j] = a[i] + q[j - 1].query();
    for (int j = 0; j <= k; j++) q[j].push_back(dp[i][j]);
  }
  int64_t answer = -inf;
  for (int j = n; j >= n - x + 1; j--) chkmax(answer, dp[j][k]);
  if (answer < 0)
    cout << -1 << '\n';
  else
    cout << answer << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
