#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 5e3 + 7;
const int maxm = 1e5 + 7;
const int mod = 1e9 + 7;
const double eps = 1e-6;
int n, k, x;
long long a[maxn];
long long f[maxn][maxn];
long long ans = -1;
deque<pair<long long, long long> > Q[maxn];
int main(int argc, char const *argv[]) {
  scanf("%d%d%d", &n, &k, &x);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  Q[0].push_back(make_pair(0, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i && j <= x; j++)
      while (!Q[j].empty() && Q[j].front().second + k < i) Q[j].pop_front();
    for (int j = 1; j <= i && j <= x; j++)
      if (!Q[j - 1].empty() && Q[j - 1].front().first != -1)
        f[i][j] = Q[j - 1].front().first + a[i];
    for (int j = 0; j <= i && j <= x; j++) {
      while (!Q[j].empty() && f[i][j] >= Q[j].back().first) Q[j].pop_back();
      if (f[i][j] != -1) Q[j].push_back(make_pair(f[i][j], i));
    }
    if (i + k > n) ans = max(ans, f[i][x]);
  }
  printf("%lld\n", ans);
  return 0;
}
