#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long int n, k, x;
vector<vector<long long int>> dp;
long long int a[300009];
deque<pair<long long int, long long int>> q;
void del() {
  while (!q.empty()) {
    q.pop_back();
  }
}
void insertion(pair<long long int, long long int> p) {
  while (!q.empty()) {
    pair<long long int, long long int> lst = q.back();
    if (lst.first >= p.first) {
      q.push_back(p);
      return;
    } else {
      q.pop_back();
    }
  }
  q.push_back(p);
}
long long int getMax(long long int j) {
  long long int per = j - k + 1;
  while (q.front().second < per) {
    q.pop_front();
  }
  return q.front().first;
}
int32_t main() {
  cin >> n >> k >> x;
  dp.resize(n + 1);
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i <= n; i++) {
    dp[i].resize(x + 1, LLONG_MIN);
  }
  dp[0][0] = 0;
  for (long long int i = 1; i <= x; i++) {
    del();
    for (long long int j = 1; j <= n; j++) {
      insertion({dp[j - 1][i - 1], j});
      if (i == 1) {
        if ((j > k)) continue;
        dp[j][1] = a[j];
        continue;
      }
      dp[j][i] = getMax(j) + a[j];
    }
  }
  long long int ans = LLONG_MIN;
  for (long long int i = max((long long int)0, n - k + 1); i <= n; i++) {
    ans = max(ans, dp[i][x]);
  }
  if (ans < 0) {
    cout << "-1\n";
    return 0;
  }
  cout << ans << "\n";
  return 0;
}
