#include <bits/stdc++.h>
using namespace std;
const int mod = 1073676287;
const int N = 5007;
int n, k, x, a[N];
long long f[N][N], ans = -0x3f;
deque<int> q;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(f, -0x3f, sizeof f);
  cin >> n >> k >> x;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= k; ++i) f[i][1] = a[i];
  for (int j = 2; j <= x; ++j) {
    q.clear();
    q.push_back(j - 1);
    for (int i = j; i <= n; ++i) {
      if (q.empty()) continue;
      while (i - q.front() > k) q.pop_front();
      f[i][j] = f[q.front()][j - 1] + 0ll + a[i];
      while (q.size() && f[i][j - 1] >= f[q.back()][j - 1]) q.pop_back();
      q.push_back(i);
    }
  }
  for (int i = n; i >= n - k + 1; --i) ans = max(ans, f[i][x]);
  if (ans < 0)
    cout << -1;
  else
    cout << ans;
  return 0;
}
