#include <bits/stdc++.h>
using namespace std;
long long n, d, m;
vector<long long> vec, vec2;
vector<long long> svec;
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> d >> m;
  long long a;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    if (a > m)
      vec.push_back(a);
    else
      vec2.push_back(a);
  }
  for (int i = 1; i <= 2 * d; i++) vec2.push_back(0);
  sort(vec.rbegin(), vec.rend());
  sort(vec2.rbegin(), vec2.rend());
  svec.push_back(0);
  for (int i = 0; i < vec2.size(); i++) svec.push_back(vec2[i] + svec.back());
  long long ans = -1e18, sum = 0;
  for (int i = 0; i <= vec.size(); i++) {
    long long rem = (n - i) - max(i - 1, 0) * d;
    if (rem <= vec2.size() && rem >= 0) {
      ans = max(ans, svec[rem] + sum);
    }
    if (i < vec.size()) sum += vec[i];
  }
  cout << ans << endl;
  return 0;
}
