#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d, m;
  cin >> n >> d >> m;
  vector<long long> big, small;
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    if (temp > m) {
      big.push_back(temp);
    } else {
      small.push_back(temp);
    }
  }
  sort(small.begin(), small.end());
  reverse(small.begin(), small.end());
  sort(big.begin(), big.end());
  reverse(big.begin(), big.end());
  vector<long long> pref_small, pref_big;
  if (small.size() >= 1) pref_small.push_back(small[0]);
  if (big.size() >= 1) pref_big.push_back(big[0]);
  for (long long i = 1; i < small.size(); i++) {
    pref_small.push_back(pref_small[i - 1] + small[i]);
  }
  for (long long i = 1; i < big.size(); i++) {
    pref_big.push_back(pref_big[i - 1] + big[i]);
  }
  if (big.size() == 0) {
    cout << pref_small[pref_small.size() - 1] << endl;
    return 0;
  }
  long long ans = 0;
  for (long long i = 1; i <= big.size(); i++) {
    long long pot_rem_days = n - ((i - 1) * (d + 1) + 1);
    if (pot_rem_days < 0) continue;
    if (pot_rem_days == 0) {
      long long pot_max = pref_big[i - 1];
      ans = max(ans, pot_max);
      continue;
    }
    if (pot_rem_days <= pref_small.size()) {
      long long pot_max = pref_big[i - 1] + pref_small[pot_rem_days - 1];
      ans = max(ans, pot_max);
    }
    if (pot_rem_days > pref_small.size()) {
      if (pref_small.size() == 0) {
        ans = max(ans, pref_big[i - 1]);
      } else {
        long long pot_max = pref_big[i - 1] + pref_small[pref_small.size() - 1];
        ans = max(ans, pot_max);
      }
    }
  }
  cout << ans << endl;
}
