#include <bits/stdc++.h>
using namespace std;
const long long NEG_INF = -(1e18);
struct MaxStack {
  vector<pair<long long, long long>> a;
  void push(long long v) {
    auto mx = max(v, best());
    a.push_back({v, mx});
  }
  long long best() { return a.empty() ? NEG_INF : a.back().second; }
  long long pop() {
    auto res = a.back().first;
    a.pop_back();
    return res;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k, x;
  cin >> n >> k >> x;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(x + 1, vector<long long>(n, NEG_INF));
  for (int i = 0; i < k; i++) {
    dp[1][i] = a[i];
  }
  for (int y = 2; y <= x; y++) {
    MaxStack s1, s2;
    auto psh = [&](long long v) { s1.push(v); };
    auto bst = [&]() -> long long {
      if (s1.a.size() == 0 && s2.a.size() == 0) {
        return 0;
      }
      return max(s1.best(), s2.best());
    };
    auto pop = [&]() {
      if (s2.a.empty()) {
        while (s1.a.size() > 0) {
          s2.push(s1.pop());
        }
      }
      s2.pop();
    };
    for (int i = 0; i < n; i++) {
      dp[y][i] = bst() + a[i];
      psh(dp[y - 1][i]);
      if (i >= k) {
        pop();
      }
    }
  }
  long long ans = -1;
  for (int i = n - 1; i >= n - k; i--) {
    ans = max(ans, dp[x][i]);
  }
  cout << ans << endl;
}
