#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, d, m;
  cin >> n >> d >> m;
  vector<int> small;
  vector<int> big;
  long long ans = 0L;
  for (int i = 0; i < n; i++) {
    int cur;
    cin >> cur;
    if (cur <= m) {
      small.push_back(cur);
      ans += cur;
    } else {
      big.push_back(cur);
    }
  }
  if (small.size() > 1) {
    sort(small.begin(), small.end());
  }
  if (big.size() > 1) {
    sort(big.begin(), big.end());
  }
  int s = small.size();
  int ss = big.size() - 1;
  long long sum[s + 1];
  sum[0] = 0;
  for (int i = 1; i <= s; i++) {
    sum[i] = sum[i - 1] + small[i - 1];
  }
  int ii = 0;
  int block = -1;
  for (int i = ss; i >= 0; i--) {
    if (i == ss) {
      ans += big[i];
      continue;
    }
    if (block < i) {
      if (block + d < i) {
        block += d;
        ans += big[i];
      } else {
        int dd = d - (i - block - 1);
        if (ii + dd > s) break;
        if (sum[ii + dd] - sum[ii] < big[i]) {
          block = i - 1;
          ans += big[i];
          ans -= (sum[ii + dd] - sum[ii]);
          ii += dd;
        } else {
          break;
        }
      }
    } else {
      if (ii + d + 1 > s) break;
      if (sum[ii + d + 1] - sum[ii] < big[i]) {
        ans += big[i];
        ans -= (sum[ii + d + 1] - sum[ii]);
        ii += d + 1;
      } else {
        break;
      }
    }
  }
  cout << ans << endl;
}
int main() {
  int t = 1;
  for (int tt = 0; tt < t; tt++) solve();
  return 0;
}
