#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long fast_exp(long long a, long long b) {
  if (b <= 0)
    return 1;
  else {
    long long res = 1;
    res = fast_exp(a, b / 2);
    res = (res * res) % mod;
    if (b % 2 == 1) res = (res * a) % mod;
    return res;
  }
}
const long long N = 1e5;
vector<long long> maxim, minim;
long long n, d, m;
long long check(long long mid) {
  long long cur = 0, cnt = 0;
  for (long long i = 0; i < (long long)maxim.size(); i++) {
    if (i + 1 <= mid)
      cur += maxim[i];
    else
      cnt++;
  }
  long long need = (mid - 1) * d;
  for (long long i = 0; i < (long long)minim.size(); i++) {
    if (cnt < need)
      cnt++;
    else {
      cur += minim[i];
    }
  }
  return cur;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> d >> m;
  long long a[n];
  d = min(d, n);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > m)
      maxim.push_back(a[i]);
    else
      minim.push_back(a[i]);
  }
  sort(maxim.begin(), maxim.end(), greater<long long>());
  sort(minim.begin(), minim.end());
  long long l = min(1LL, (long long)maxim.size());
  long long r = (long long)maxim.size();
  r = min(
      r, ((long long)minim.size() + (long long)maxim.size() - 1) / (d + 1) + 1);
  while (l < r) {
    long long mid = (l + r) / 2;
    if (r - l == 1) {
      ans = max(ans, check(l));
      ans = max(ans, check(r));
      break;
    } else {
      long long op1 = check(mid);
      long long op2 = check(mid + 1);
      if (op2 <= op1) {
        r = mid;
      } else {
        l = mid + 1;
      }
    }
  }
  ans = max(ans, check(l));
  cout << ans << '\n';
  return 0;
}
