#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
const long long INF = 1e18;
long long dp[N][N];
long long n, k, x;
long long g[N];
int que[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) cin >> g[i];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) dp[i][j] = -INF;
  dp[0][0] = 0;
  for (int j = 1; j <= x; j++) {
    que[0] = 0;
    int l = 0, r = 1;
    for (int i = 1; i <= n; i++) {
      while (l < r && que[l] < i - k) l++;
      dp[i][j] = dp[que[l]][j - 1] + g[i];
      while (l < r && dp[que[r - 1]][j - 1] <= dp[i][j - 1]) r--;
      que[r++] = i;
    }
  }
  long long ans = -INF;
  for (int i = n - k + 1; i <= n; i++) ans = max(ans, dp[i][x]);
  if (ans <= 0)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
