#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, b;
  cin >> n >> k >> b;
  vector<long long int> arr(n);
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  vector<long long int> big, sma;
  for (long long int i = 0; i < n; i++) {
    if (arr[i] > b)
      big.push_back(arr[i]);
    else
      sma.push_back(arr[i]);
  }
  sort(big.begin(), big.end());
  sort(sma.begin(), sma.end());
  reverse(big.begin(), big.end());
  long long int tot = 0;
  for (long long int i = 0; i < (long long int)sma.size(); i++) tot += sma[i];
  long long int ans = tot;
  long long int cnt = 0;
  long long int pta = 0;
  while (true) {
    if (cnt >= (long long int)big.size()) break;
    tot += big[cnt];
    long long int left_big = (long long int)big.size() - 1 - cnt;
    long long int del = max((long long int)0, k * cnt - left_big - pta);
    bool bo = true;
    for (long long int i = 0; i < del; i++) {
      if (pta == (long long int)sma.size()) {
        bo = false;
        break;
      }
      tot -= sma[pta];
      pta++;
    }
    if (!bo) break;
    ans = max(ans, tot);
    cnt++;
  }
  cout << ans;
}
