#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long ab[N], psum[N];
int main() {
  int n, d, m;
  scanf("%d%d%d", &n, &d, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &ab[i]);
  }
  sort(ab + 1, ab + n + 1);
  psum[0] = 0ll;
  for (int i = 1; i <= n; i++) psum[i] = (psum[i - 1] + ab[i]);
  int a = -1;
  for (int i = 1; i <= n; i++) {
    if (ab[i] > m) {
      a = i - 1;
      break;
    }
  }
  if (a == -1) {
    printf("%lld\n", psum[n]);
  } else {
    int b = n - a;
    long long ans = -1;
    for (int i = 1; i <= b; i++) {
      long long x = i;
      long long maxrem = d * x + x;
      if (maxrem < b)
        continue;
      else {
        long long minrem = x + d * x - d;
        long long rem = max(0ll, minrem - b);
        if (rem > a) continue;
        long long myans = psum[n] - psum[n - i];
        myans += psum[a] - psum[rem];
        ans = max(ans, myans);
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
