#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 40;
long long up[MAXN], down[MAXN], n, d, m;
long long cnt1, cnt2, top1, top2, sum, ans;
bool cmp(long long a, long long b) { return a > b; }
signed main() {
  scanf("%lld%lld%lld", &n, &d, &m);
  for (long long i = 1; i <= n; i++) {
    long long a;
    scanf("%lld", &a);
    if (a > m)
      up[++cnt1] = a;
    else
      down[++cnt2] = a;
  }
  sort(up + 1, up + cnt1 + 1, cmp);
  sort(down + 1, down + cnt2 + 1, cmp);
  for (long long i = 1; i <= min(d + 1, cnt2); i++) sum += down[i];
  for (long long i = 1; i <= n + d; i++) {
    if (i <= n) {
      if (top1 < cnt1 && (up[top1 + 1] >= sum || top2 >= cnt2)) {
        ans += up[++top1];
        i += d;
      } else {
        if (top2 < cnt2) {
          ans += down[++top2];
          sum -= down[top2];
          if (top2 + d + 1 <= cnt2) sum += down[top2 + d + 1];
        }
      }
    } else if (top1 > 0 && top2 < cnt2)
      ans += down[++top2];
    else
      break;
  }
  printf("%lld\n", ans);
  return 0;
}
