#include <bits/stdc++.h>
using namespace std;
long long dp[5005][5005];
deque<int> dq[5005];
int a[5005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k, x;
  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  dq[0].push_back(0);
  for (int i = 1; i <= n; i++) {
    for (int l = x - 1; l >= 0; l--) {
      while (!dq[l].empty() && i - dq[l].front() > k) dq[l].pop_front();
      if (dq[l].empty()) continue;
      dp[i][l + 1] = max(dp[i][l + 1], dp[dq[l].front()][l] + a[i]);
      while (!dq[l + 1].empty() && dp[dq[l + 1].back()][l + 1] <= dp[i][l + 1])
        dq[l + 1].pop_back();
      dq[l + 1].push_back(i);
    }
  }
  long long ans = -1;
  for (int i = n; i >= n - k + 1; i--) ans = max(ans, dp[i][x]);
  printf("%lld\n", ans);
}
