#include <bits/stdc++.h>
using namespace std;
const long long INF64 = (long long)1e16;
const int INF = 1e9 + 500;
const int mod = (int)1e9 + 7;
void test_case() {
  int n, k, x;
  cin >> n >> k >> x;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long dp[n + 1][n + 1];
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) dp[i][j] = -INF64;
  dp[0][0] = 0;
  vector<deque<pair<long long, int> > > dq(x + 1,
                                           deque<pair<long long, int> >());
  dq[0].push_back({0, 0});
  for (int i = 1; i <= n; i++) {
    for (int rem = 1; rem <= x; rem++) {
      if (dq[rem - 1].size()) {
        long long y = dq[rem - 1].front().first;
        dp[i][rem] = max(dp[i][rem], (long long)arr[i - 1] + y);
      }
    }
    for (int rem = 0; rem <= x; rem++) {
      if (dq[rem].size() && dq[rem].front().second + k <= i) {
        dq[rem].pop_front();
      }
      long long val = dp[i][rem];
      while (dq[rem].size() && dq[rem].back().first < val) {
        dq[rem].pop_back();
      }
      dq[rem].push_back({val, i});
    }
  }
  long long ans = -INF64;
  for (int i = n - k + 1; i <= n; i++) {
    ans = max(ans, dp[i][x]);
  }
  if (ans < 0) ans = -1;
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) test_case();
}
