#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long re = 0, k = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') k = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    re = re * 10 + ch - 48;
    ch = getchar();
  }
  return re * k;
}
inline void write(long long x) {
  if (x < 0) return putchar('-'), write(-x), void();
  if (x < 10) return putchar(x + 48), void();
  return write(x / 10), write(x % 10), void();
}
long long n, d, m, a[100005], b[100005], la, lb, s[100005], ans;
signed main() {
  n = read();
  d = read();
  m = read();
  for (long long i = 1; i <= n; i++) {
    long long x = read();
    if (x > m)
      a[++la] = x;
    else
      b[++lb] = x;
  }
  sort(a + 1, a + la + 1, greater<long long>());
  sort(b + 1, b + lb + 1);
  for (long long i = 1; i <= lb; i++) s[i] = s[i - 1] + b[i];
  if (!la) {
    write(s[lb]);
    return 0;
  }
  long long now = 0;
  for (long long i = 1; i <= la; i++) {
    now += a[i];
    if ((i - 1) * d <= la - i)
      ans = max(ans, now + s[lb]);
    else if ((i - 1) * d - la + i <= lb)
      ans = max(ans, now + s[lb] - s[(i - 1) * d - la + i]);
    else
      break;
  }
  write(ans);
}
