#include <bits/stdc++.h>
using namespace std;
using tint = long long;
using ld = long double;
using pi = pair<int, int>;
using pl = pair<tint, tint>;
using vi = vector<int>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vvi = vector<vi>;
using vl = vector<tint>;
using vb = vector<bool>;
const int MOD = 1e9 + 7;
const int mod = 998244353;
const int MX = 805;
const tint INF = 1e18;
const int inf = 2e9;
const ld PI = acos(ld(-1));
const ld eps = 1e-5;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
template <class T>
void remDup(vector<T>& v) {
  sort(begin(v), end(v));
  v.erase(unique(begin(v), end(v)), end(v));
}
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
bool valid(int x, int y, int n, int m) {
  return (0 <= x && x < n && 0 <= y && y < m);
}
int cdiv(int a, int b) { return a / b + ((a ^ b) > 0 && a % b); }
int fdiv(int a, int b) { return a / b - ((a ^ b) < 0 && a % b); }
void NACHO(string name = "") {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if ((int)(name).size()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
template <class T>
struct MaxQueue {
  deque<pair<T, int>> q;
  int lo = 0, hi = -1;
  void insert(T x) {
    while ((int)(q).size() && q.back().first <= x) q.pop_back();
    q.push_back(make_pair(x, ++hi));
  }
  void del() {
    if ((int)(q).size() && q.front().second == lo++) q.pop_front();
  }
  T get() { return (int)(q).size() ? q.front().first : -inf; }
  void clear() {
    q.clear();
    lo = 0, hi = -1;
  }
};
tint dp[5005][5005];
tint a[5005];
int main() {
  NACHO();
  int n, k, x;
  cin >> n >> k >> x;
  for (int i = (0); i < (n); ++i) cin >> a[i];
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (x + 1); ++j) dp[i][j] = -INF;
  MaxQueue<tint> q;
  for (int i = (0); i < (k); ++i) dp[i][1] = a[i];
  for (int j = (1); j < (x + 1); ++j) {
    for (int i = (0); i < (k); ++i)
      ckmax(dp[i][j], q.get() + a[i]), q.insert(dp[i][j - 1]);
    for (int i = (k); i < (n); ++i) {
      ckmax(dp[i][j], q.get() + a[i]);
      q.del();
      q.insert(dp[i][j - 1]);
    }
    q.clear();
  }
  tint ret = -1;
  for (int i = (n - k); i < (n); ++i) {
    ckmax(ret, dp[i][x]);
  }
  cout << ret << "\n";
}
