#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5 + 5, MXX = 23;
const long long mod = 1e9 + 7, inf = 1e18 + 6;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(9);
  int n, d, m;
  cin >> n >> d >> m;
  long long Ws = 0;
  vector<int> bg, sm;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (a <= m)
      sm.push_back(a), Ws += a;
    else
      bg.push_back(a);
  }
  sort(bg.begin(), bg.end());
  sort(sm.begin(), sm.end());
  long long Wb = 0;
  int rm = bg.size(), in = 0, ls = bg.size() - 1, fr = 0;
  while (rm) {
    if (rm >= d + 1)
      rm -= d + 1;
    else
      in = rm - 1, rm = 0;
    Wb += bg[ls--];
  }
  long long ans = Ws + Wb;
  if (bg.size() % (d + 1) == 0 && ls != -1 && fr != sm.size())
    Ws -= sm[fr++], Wb += bg[ls--];
  ans = max(ans, Ws + Wb);
  while (d - in + 1 <= sm.size() - fr && ls != -1) {
    for (int i = 0; i < d - in + 1; ++i) Ws -= sm[fr++];
    in = 0;
    Wb += bg[ls--];
    ans = max(ans, Ws + Wb);
  }
  cout << ans << "\n";
  return 0;
}
