#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
ostream& operator<<(ostream& cout, set<T> V) {
  cout << "[ ";
  for (auto v : V) cout << v << ' ';
  return cout << ']';
}
template <class T>
ostream& operator<<(ostream& cout, vector<T> V) {
  cout << "[ ";
  for (auto v : V) cout << v << ' ';
  return cout << ']';
}
template <class L, class R>
ostream& operator<<(ostream& cout, pair<L, R> P) {
  return cout << '(' << P.first << ',' << P.second << ')';
}
int n, k, x;
vector<int> a;
vector<vector<long long int>> dp;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k >> x;
  a.resize(n);
  dp.resize(n + 1, vector<long long int>(x + 1, (long long int)-1));
  for (int i = 0; i < (n); i++) cin >> a[i];
  vector<set<pair<long long int, int>>> s(x + 1);
  for (int i = 0; i < (x + 1); i++) dp[0][i] = 0;
  s[0].insert({0, 0});
  for (int i = 1; i <= n; i++) {
    for (int j = min(x, i); j > 0; j--) {
      if (!s[j - 1].size()) continue;
      auto itr = s[j - 1].end();
      itr--;
      dp[i][j] = (*itr).first + a[i - 1];
      if (s[j].size()) {
        itr = s[j].begin();
        while (s[j].size() && (*itr).first <= dp[i][j]) {
          s[j].erase(itr++);
        }
      }
      s[j].insert({dp[i][j], i});
    }
    if (i - k >= 0) {
      for (int j = 0; j < (min(i - k + 1, x + 1)); j++) {
        if (s[j].find({dp[i - k][j], i - k}) != s[j].end())
          s[j].erase({dp[i - k][j], i - k});
      }
    }
  }
  long long int ans = -1;
  for (int i = n; i > n - k; i--) {
    ans = max(ans, dp[i][x]);
  }
  if (ans < 0)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
  cerr << "Time : " << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC
       << "ms\n";
  ;
}
