#include <bits/stdc++.h>
using namespace std;
long long it[100001];
long long pre[100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, d, m;
  cin >> n >> d >> m;
  long long su = 0;
  long long ans = 0;
  long long st = 1;
  vector<long long> aa;
  vector<long long> bb;
  for (long long i = 0; i < n; i++) {
    cin >> it[i];
    if (it[i] <= m) {
      su += it[i];
      bb.push_back(it[i]);
    } else {
      st = 0;
      aa.push_back(it[i]);
    }
  }
  ans = su;
  if (st) {
    cout << su << endl;
    return 0;
  }
  sort(aa.begin(), aa.end());
  if (bb.size()) {
    sort(bb.begin(), bb.end());
    for (int i = 1; i <= bb.size(); i++) {
      pre[i] = pre[i - 1] + bb[i - 1];
    }
  }
  reverse(aa.begin(), aa.end());
  long long cur = 0;
  for (int i = 0; i < aa.size(); i++) {
    int x = n - i * d - i - 1;
    cur += aa[i];
    if (x < 0) {
      break;
    }
    if (aa.size() >= i * d + i + 1) {
      ans = max(ans, pre[bb.size()] + cur);
    } else {
      ans = max(ans, cur + pre[bb.size()] - pre[i * d - (aa.size() - i - 1)]);
    }
  }
  cout << ans << endl;
  return 0;
}
