#include <bits/stdc++.h>
using namespace std;
using cd = complex<double>;
const int N = 3e3 + 5;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const double Pi = acos(-1);
const int p = 510200;
void Fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int k, n, x;
long long a[5005];
long long dp[5005][5005];
deque<pair<long long, int> > Q[5005];
signed main() {
  Fastio();
  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= x; j++) {
      dp[i][j] = -1e17;
    }
  }
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = x; j >= 1; j--) {
      while (Q[j - 1].empty() == false && Q[j - 1].front().second < i - k) {
        Q[j - 1].pop_front();
      }
      while (Q[j - 1].empty() == false &&
             Q[j - 1].back().first <= dp[i - 1][j - 1]) {
        Q[j - 1].pop_back();
      }
      Q[j - 1].push_back(make_pair(dp[i - 1][j - 1], i - 1));
      dp[i][j] = Q[j - 1].front().first + a[i];
    }
  }
  long long ans = -1e17;
  for (int i = n - k + 1; i <= n; i++) {
    ans = max(ans, dp[i][x]);
  }
  cout << max(ans, -1ll);
}
