#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, d, m;
  cin >> n >> d >> m;
  vector<long long> a, b;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    if (x > m)
      b.push_back(x);
    else
      a.push_back(x);
  }
  sort(a.begin(), a.end(), greater<int>());
  sort(b.begin(), b.end(), greater<int>());
  int s = b.size();
  int t = a.size();
  for (int i = 1; i < s; i++) b[i] += b[i - 1];
  for (int i = 1; i < t; i++) a[i] += a[i - 1];
  long long ans = 0;
  if (t >= 1) ans = a[t - 1];
  for (int x = 1; x <= s; x++) {
    long long k = ((x - 1) * d) - s + x;
    if (k < 0) k = 0;
    if (t - k >= 0) {
      long long cur = b[x - 1];
      if (t - k > 0) cur += a[t - k - 1];
      ans = max(ans, cur);
    }
  }
  cout << ans;
}
