#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000005;
const int inf = 0x3f3f3f3f;
int n, k, x;
long long dp[5005][5005];
int a[5005];
deque<int> q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> x;
  memset(dp, -0x3f, sizeof(dp));
  dp[0][0] = 0ll;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int j = 1; j <= x; j++) {
    q.clear();
    q.push_back(0);
    for (int i = 1; i <= n; i++) {
      while (q.size() && q.front() < i - k) q.pop_front();
      dp[i][j] = dp[q.front()][j - 1] + a[i];
      while (q.size() && dp[q.back()][j - 1] < dp[i][j - 1]) q.pop_back();
      q.push_back(i);
    }
  }
  long long ans = -1;
  for (int i = n; i >= n - k + 1; i--) ans = max(ans, dp[i][x]);
  cout << ans << '\n';
  return 0;
}
