#include <bits/stdc++.h>
using namespace std;
bool compare(long long int a, long long int b) { return a > b; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, d, m;
  cin >> n >> d >> m;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  vector<long long int> vs;
  vector<long long int> vg;
  for (long long int i = 0; i < n; i++) {
    if (a[i] <= m)
      vs.push_back(a[i]);
    else
      vg.push_back(a[i]);
  }
  sort(vs.begin(), vs.end(), compare);
  sort(vg.begin(), vg.end(), compare);
  if (vg.size() == 0) {
    long long int cost = 0;
    for (long long int i = 0; i < vs.size(); i++) cost += vs[i];
    cout << cost << "\n";
    return 0;
  }
  if (vs.size() == 0) {
    long long int k = n / (d + 1);
    if (n % (d + 1)) k++;
    long long int cost = 0;
    for (long long int i = 0; i < k; i++) cost += vg[i];
    cout << cost << "\n";
    return 0;
  }
  long long int s = vs.size();
  long long int g = vg.size();
  vector<long long int> prefs(s);
  prefs[0] = vs[0];
  for (long long int i = 1; i < vs.size(); i++) prefs[i] = prefs[i - 1] + vs[i];
  vector<long long int> prefg(g);
  prefg[0] = vg[0];
  for (long long int i = 1; i < vg.size(); i++) prefg[i] = prefg[i - 1] + vg[i];
  long long int cost = 0;
  for (long long int i = 0; i < vg.size(); i++) {
    long long int sum = prefg[i];
    long long int left = g - i - 1;
    long long int places = i * d;
    if (places < left) {
      long long int extra = left - places;
      if (extra > d) continue;
      places = 0;
      left = 0;
    }
    if (places > left + s) continue;
    places -= left;
    if (s - places - 1 >= 0) sum += prefs[s - places - 1];
    cost = max(cost, sum);
  }
  cout << cost << "\n";
}
