#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 7;
int a[N];
long long dp[N][N];
deque<int> Q;
int n, k, x;
int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  cin >> n >> k >> x;
  for (int i = (1); i < (n + 1); ++i) cin >> a[i];
  memset(dp, -1, sizeof dp);
  dp[0][0] = 0;
  for (int j = (1); j < (n + 1); ++j) {
    Q.clear();
    Q.push_back(0);
    for (int i = (1); i < (n + 1); ++i) {
      if (dp[Q.front()][j - 1] != -1) dp[i][j] = dp[Q.front()][j - 1] + a[i];
      while (((int)(Q).size())) {
        int last = Q.back();
        if (dp[last][j - 1] <= dp[i][j - 1])
          Q.pop_back();
        else
          break;
      }
      Q.push_back(i);
      if (((int)(Q).size()) && Q.front() == i - k) Q.pop_front();
    }
  }
  long long ans = -1;
  for (int i = (n - k + 1); i < (n + 1); ++i) ans = max(ans, dp[i][x]);
  cout << ans << "\n";
  return 0;
}
