#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
char buf[1 << 12], *p1 = buf, *p2 = buf, nc;
int ny;
inline char gc() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 12, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int x = 0;
  ny = 1;
  while (nc = gc(), (nc < 48 || nc > 57) && nc != EOF)
    if (nc == 45) ny = -1;
  if (nc < 0) return nc;
  x = nc - 48;
  while (nc = gc(), 47 < nc && nc < 58 && nc != EOF)
    x = (x << 3) + (x << 1) + (nc ^ 48);
  return x * ny;
}
int n, d, m, cnt1, cnt2;
long long a[MAXN], b[MAXN], Sum[MAXN];
inline bool cmp(int x, int y) { return x > y; }
int main() {
  n = read(), d = read(), m = read();
  for (int i = 1; i <= n; ++i) {
    int x = read();
    if (x > m)
      a[++cnt1] = x;
    else
      b[++cnt2] = x;
  }
  sort(a + 1, a + cnt1 + 1, cmp), sort(b + 1, b + cnt2 + 1, cmp);
  for (int i = 1; i <= cnt2; ++i) Sum[i] = Sum[i - 1] + b[i];
  long long ans = 0, tmp = 0;
  for (int i = 0; i <= cnt1; ++i) {
    tmp += a[i];
    if ((i - 1) * d + i > n) break;
    int o = (i - 1) * d - (cnt1 - i);
    o = max(o, 0);
    if (cnt2 >= o)
      ans = max(ans, tmp + Sum[cnt2 - o]);
    else
      ans = max(ans, tmp);
  }
  cout << ans << '\n';
  return 0;
}
