#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 1;
long long dp[N][N];
long long a[N];
int main() {
  int n, x, k;
  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= x; j++) {
      dp[i][j] = -1;
    }
  }
  for (int i = 1; i <= k; i++) {
    dp[i][1] = a[i];
  }
  for (int j = 2; j <= x; j++) {
    stack<pair<long long, long long>> s1, s2;
    for (int i = 1; i <= n; i++) {
      long long mx = -1;
      if (s1.size()) mx = max(mx, s1.top().second);
      if (s2.size()) mx = max(mx, s2.top().second);
      if (mx != -1) {
        dp[i][j] = mx + a[i];
      }
      if (s1.size() + s2.size() < k) {
        if (s1.size()) {
          s1.push({dp[i][j - 1], max(s1.top().second, dp[i][j - 1])});
        } else {
          s1.push({dp[i][j - 1], dp[i][j - 1]});
        }
      } else {
        if (!s2.size()) {
          long long mx = -1;
          while (s1.size()) {
            s2.push({s1.top().first, max(mx, s1.top().first)});
            mx = s2.top().second;
            s1.pop();
          }
        }
        if (s1.size()) {
          s1.push({dp[i][j - 1], max(dp[i][j - 1], s1.top().second)});
        } else {
          s1.push({dp[i][j - 1], dp[i][j - 1]});
        }
        s2.pop();
      }
    }
  }
  long long ans = -1;
  for (int i = n - k + 1; i <= n; i++) {
    ans = max(ans, dp[i][x]);
  }
  cout << ans;
  return 0;
}
