#include <bits/stdc++.h>
using namespace std;
long long n, d, m;
long long cost(vector<long long> less, vector<long long> more,
               long long times) {
  vector<long long> taken, not_taken;
  for (long long i = 0; i < more.size(); i++) {
    if (i < more.size() - times)
      not_taken.push_back(more[i]);
    else
      taken.push_back(more[i]);
  }
  if (times == 0) {
    long long sum = 0;
    for (long long i : less) sum += i;
    return sum;
  }
  if ((times - 1) * d > less.size() + not_taken.size()) return -1;
  long long ans = 0;
  for (long long i : taken) ans += i;
  long long taking = max((times - 1) * d - (long long)not_taken.size(), 0LL);
  for (long long i = taking; i < less.size(); i++) {
    ans += less[i];
  }
  return ans;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> d >> m;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  vector<long long> less, more;
  for (long long i = 0; i < n; i++) {
    if (a[i] <= m) {
      less.push_back(a[i]);
    } else {
      more.push_back(a[i]);
    }
  }
  long long l = 0, r = more.size(), mid;
  while (l < r) {
    mid = (l + r) / 2;
    if (cost(less, more, mid) >= cost(less, more, mid + 1)) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  mid = (l + r) / 2;
  long long ans = cost(less, more, mid);
  cout << ans << endl;
  return 0;
}
