#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int N = 1e5 + 10;
ifstream fin("test.txt");
int main() {
  int n, k, x;
  cin >> n >> k >> x;
  vector<long long> v(n);
  for (int i = 0; i < (n); i++) cin >> v[i];
  vector<deque<pair<long long, long long> > > q(x + 1);
  vector<vector<long long> > dp(n, vector<long long>(x + 1, -1));
  q[0].push_back({0, -1});
  for (int i = 0; i < (n); i++) {
    for (int j = x; j >= 1; j--) {
      if (!q[j - 1].empty()) {
        if (q[j - 1].front().second < i - k) q[j - 1].pop_front();
        if (q[j - 1].empty()) continue;
        long long z = q[j - 1].front().first + v[i];
        dp[i][j] = z;
        while (!q[j].empty() && q[j].back().first < dp[i][j]) q[j].pop_back();
        q[j].push_back(make_pair(dp[i][j], i));
      }
    }
  }
  long long ans = -1;
  for (int i = max(n - k, 0); i < n; i++) ans = max(ans, dp[i][x]);
  cout << ans;
}
