#include <bits/stdc++.h>
using namespace std;
int N, D, M;
long long s[100005], b[100005];
int si = 0, bi = 0;
long long pre[100005];
bool comp(long long a, long long b) { return a > b; }
int main() {
  scanf("%d %d %d", &N, &D, &M);
  for (int i = 1; i <= N; i++) {
    long long u;
    scanf("%lld", &u);
    if (u <= M)
      s[++si] = u;
    else
      b[++bi] = u;
  }
  sort(s + 1, s + 1 + si, comp);
  sort(b + 1, b + 1 + bi, comp);
  for (int i = 1; i <= si; i++) {
    pre[i] = pre[i - 1] + s[i];
  }
  bool flg = 1;
  int l = 1, r = 1;
  int len = 0;
  long long ans = 0;
  while (len < N) {
    int res;
    if (flg)
      res = 0;
    else
      res = D;
    long long sum = pre[min(si, l + res)] - pre[l - 1];
    if (l > si && len + 1 + res > N) break;
    if (len + 1 + res > N || r > bi || sum > b[r]) {
      ans += s[l];
      ++l;
      ++len;
    } else {
      ans += b[r];
      flg = 0;
      ++r;
      len += 1 + res;
    }
  }
  cout << ans << endl;
  return 0;
}
