#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using G = vector<vector<int>>;
using ll = long long;
int main() {
  ll n, k, q;
  cin >> n >> k >> q;
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  ll b[n];
  for (int i = 0; i < n; i++) b[i] = a[i];
  sort(b, b + n);
  if (q == 1) {
    cout << 0 << endl;
    return 0;
  }
  ll M = b[n - 1] - b[0];
  for (int i = 0; i <= n - q; i++) {
    M = min(M, accumulate(a + i, a + i + q - 1, 0LL));
  }
  cout << M << endl;
}
