#include <bits/stdc++.h>
using namespace std;
mt19937 rnd;
const int N = 1e5 + 10;
long long a[N], pref[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, d, m;
  cin >> n >> d >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] + a[i];
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] <= m) {
      cnt++;
    }
  }
  long long ans = 0;
  for (int k = 0; k <= n - cnt; k++) {
    if (1ll * k * d + k + cnt < n) {
      continue;
    }
    if (1ll * (k - 1) * d + k > n) {
      continue;
    }
    int x = min(cnt, n - (k - 1) * d - k);
    ans = max(ans, pref[cnt] - pref[cnt - x] + pref[n] - pref[n - k]);
  }
  cout << ans << "\n";
  return 0;
}
