#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d, m;
  cin >> n >> d >> m;
  long long ans = 0;
  long long a[n];
  vector<long long> big, small;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    if (a[i] > m)
      big.push_back(a[i]);
    else
      small.push_back(a[i]);
  }
  sort(big.rbegin(), big.rend());
  sort(small.rbegin(), small.rend());
  long long p = big.size(), q = small.size();
  for (long long i = 1; i < p; i++) big[i] += big[i - 1];
  for (long long i = 1; i < q; i++) small[i] += small[i - 1];
  if (q > 0) ans = small[q - 1];
  for (long long i = 0; i < p; i++) {
    if (i * (d + 1) + 1 <= n) {
      ans = max(ans, big[i]);
      long long rem = n - (i * (d + 1) + 1);
      long long ind = -1;
      if (q > 0 and rem > 0) {
        ind = max(0LL, min(rem - 1LL, q - 1));
        ans = max(ans, big[i] + small[ind]);
      }
    }
  }
  cout << ans << "\n";
}
