#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  int n, d, m;
  cin >> n >> d >> m;
  vector<long long> a;
  vector<long long> b;
  int i, j;
  for (i = 0; i < n; i++) {
    cin >> j;
    if (j <= m)
      a.push_back(j);
    else
      b.push_back(j);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int as = a.size();
  int bs = b.size();
  long long total = 0;
  long long nxttotal = 0;
  int maxv = (n - 1) / (d + 1) + 1;
  maxv = min(maxv, bs);
  int keeplow;
  if (maxv == 0) {
    keeplow = as;
  } else {
    keeplow = (n - 1) - (d + 1) * (maxv - 1);
    keeplow = min(keeplow, as);
  }
  for (j = 0; j < maxv; j++) {
    nxttotal += b[bs - j - 1];
  }
  for (j = 0; j < keeplow; j++) {
    nxttotal += a[as - j - 1];
  }
  int currj = as - keeplow - 1;
  int currk = bs - maxv;
  long long nextn;
  while (nxttotal > total) {
    total = nxttotal;
    if (currj < 0) continue;
    if (currk == bs) continue;
    nxttotal -= b[currk];
    currk++;
    for (i = 0; (i < d + 1) && (currj >= 0); i++, currj--) {
      nxttotal += a[currj];
    }
  }
  cout << total << endl;
}
