#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
int n, i, j, k, t;
int x;
int a[5005];
long long dp[5001];
deque<pair<long long, int>> s[5001];
int main() {
  scanf("%d %d %d", &n, &k, &x);
  for (i = 0; i < n; ++i) scanf("%d", a + i);
  k = min(k, n);
  for (int i = 1; i <= x; ++i) s[i].push_back({-1, n});
  s[0].push_back({0, n});
  for (int i = n - 1; i >= 0; --i) {
    dp[0] = -1;
    for (int j = x; j > 0; --j) {
      dp[j] = s[j - 1].front().first;
      if (dp[j] >= 0) dp[j] += a[i];
      while (!s[j].empty() && s[j].front().first <= dp[j]) s[j].pop_front();
      while (!s[j].empty() && s[j].back().first <= dp[j]) s[j].pop_back();
      s[j].push_back({dp[j], i});
      while (s[j].front().second >= k + i) s[j].pop_front();
    }
    while (!s[0].empty() && s[0].front().first <= dp[0]) s[0].pop_front();
    while (!s[0].empty() && s[0].back().first <= dp[0]) s[0].pop_back();
    s[0].push_back({dp[0], i});
    while (s[0].front().second >= k + i) s[0].pop_front();
  }
  long long ans = -1;
  ans = max(ans, s[x].front().first);
  printf("%lld\n", ans);
  return 0;
}
