#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, d, m;
  cin >> n >> d >> m;
  vector<long long> above;
  vector<long long> below;
  for (int i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    if (temp > m)
      above.push_back(temp);
    else
      below.push_back(temp);
  }
  sort(below.rbegin(), below.rend());
  sort(above.rbegin(), above.rend());
  long long ans = 0;
  for (int i = 0; i < below.size(); i++) ans += below[i];
  if ((int)above.size() > 0) ans += above[0];
  vector<long long> temp;
  long long sum = 0;
  for (int i = 0; i < below.size(); i++) {
    sum += below[i];
    temp.push_back(sum);
  }
  below = temp;
  temp.clear();
  sum = 0;
  for (int i = 0; i < above.size(); i++) {
    sum += above[i];
    temp.push_back(sum);
  }
  above = temp;
  for (long long t = 2; t <= above.size(); t++) {
    long long x = below.size();
    long long y = above.size();
    long long cancel = (x + y - t) / (t - 1);
    if (cancel >= d) {
      long long bet = d * (t - 1);
      bet = max(bet - (y - t), (long long)0);
      long long index = x - bet;
      --index;
      long long currans = above[t - 1];
      if (index >= 0) currans += below[index];
      ans = max(ans, currans);
    } else
      break;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin.tie(NULL);
  int zz = 1;
  for (int zzz = 1; zzz <= zz; zzz++) {
    solve();
  }
  return 0;
}
