#include <bits/stdc++.h>
using namespace std;
long long n, d, m, a[300005], b[300005], s1[300005], s2[300005], c1, c2;
long long f(long long k) {
  long long tt = k * d - d;
  if (k + tt > n) return 0;
  return s1[c1] - s1[c1 - k] + s2[c2] - s2[max(tt - c1 + k, 0ll)];
}
signed main() {
  cin >> n >> d >> m;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    if (x > m)
      a[++c1] = x;
    else
      b[++c2] = x;
  }
  sort(a + 1, a + c1 + 1);
  sort(b + 1, b + c2 + 1);
  for (long long i = 1; i <= c1; i++) s1[i] = s1[i - 1] + a[i];
  for (long long i = 1; i <= c2; i++) s2[i] = s2[i - 1] + b[i];
  if (c1 == 0) {
    cout << s2[c2] << endl;
    return 0;
  }
  if (f(1) >= f(2)) {
    cout << f(1) << endl;
    return 0;
  }
  long long l = 2, r = c1;
  while (l < r) {
    long long mid = ((l + r) >> 1) + 1;
    if (f(mid) > f(mid - 1))
      l = mid;
    else
      r = mid - 1;
  }
  cout << f(l) << endl;
}
