#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const long long INF = 1e17;
int main() {
  int n, k, x;
  cin >> n >> k >> x;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) a[i] = in();
  vector<vector<long long>> dp(x + 1, vector<long long>(n + 1, -INF));
  dp[0][0] = 0;
  vector<deque<long long>> dq(x + 1);
  for (int i = 0; i < n; ++i)
    for (int j = 1; j <= x; ++j) {
      while (!dq[j - 1].empty() && dp[j - 1][dq[j - 1].back()] <= dp[j - 1][i])
        dq[j - 1].pop_back();
      dq[j - 1].push_back(i);
      long long s = dp[j - 1][dq[j - 1].front()] + a[i];
      dp[j][i + 1] = s;
      if (i - k + 1 >= 0) {
        if (dq[j - 1].front() == i - k + 1) dq[j - 1].pop_front();
      }
    }
  long long ans = -INF;
  for (int i = 0; i < k; ++i) ans = max(ans, dp[x][n - i]);
  if (ans < 0) ans = -1;
  cout << ans << endl;
  return 0;
}
