#include <bits/stdc++.h>
using namespace std;
long long in[100010], add[100010];
long long get_ans(int n, int d, int m) {
  int sum0 = 0, sum1 = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (in[i] <= m)
      sum0++;
    else if (in[i] > m)
      sum1++;
  }
  long long ss = in[n];
  ans = add[sum0];
  for (int i = 1; i <= sum1; i++) {
    if (sum1 - i >= d * (i - 1)) {
      long long store = add[sum0] + ss;
      ans = max(ans, store);
    } else if (sum1 - i < d * (i - 1)) {
      if (d * (i - 1) <= n - i) {
        int pos = d * (i - 1) - (sum1 - i);
        long long store = add[sum0] - add[pos];
        store += ss;
        ans = max(ans, store);
      } else
        break;
    }
    ss += in[n - i];
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  int n, d, m;
  cin >> n >> d >> m;
  for (int i = 1; i <= n; i++) {
    cin >> in[i];
  }
  sort(in + 1, in + n + 1);
  for (int i = 1; i <= n; i++) add[i] = add[i - 1] + in[i];
  long long ans = get_ans(n, d, m);
  cout << ans << endl;
  return 0;
}
