#include <bits/stdc++.h>
using namespace std;
const int MAX = (2e5) + 10;
int n, d, m, a, us, ds;
long long prin, boro[MAX], choto[MAX];
int main() {
  scanf("%d %d %d", &n, &d, &m);
  d = d + 1;
  for (int i = 0; i <= n - 1; i++) {
    scanf("%d", &a);
    if (a > m) {
      boro[us++] = a;
    } else {
      choto[ds++] = a;
    }
  }
  sort(boro, boro + us, [](int x, int y) { return x > y; });
  sort(choto, choto + ds, [](int x, int y) { return x > y; });
  for (int i = 1; i <= us - 1; i++) {
    boro[i] = boro[i - 1] + boro[i];
  }
  for (int i = 1; i <= ds - 1; i++) {
    choto[i] = choto[i - 1] + choto[i];
  }
  for (int i = 0; i <= ds; i++) {
    int ex = n - i;
    int round = (ex % d ? (ex / d) + 1 : (ex / d));
    round = min(round, us);
    long long v =
        (i == 0 ? 0 : choto[i - 1]) + (round == 0 ? 0 : boro[round - 1]);
    prin = max(prin, v);
  }
  printf("%lld", prin);
  return 0;
}
