#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
template <class T = int>
T __rand(T range = numeric_limits<T>::max()) {
  return (T)(rng() % range);
}
template <class T>
ostream& operator,(ostream& out, const T& thing) {
  return out << ", " << thing;
}
template <class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& p) {
  return (out << "(" << p.first, p.second) << ")";
}
template <class A, class B>
ostream& operator<<(ostream& out, const tuple<A, B>& t) {
  return (out << "(" << get<0>(t), get<1>(t)) << ")";
}
template <class A, class B, class C>
ostream& operator<<(ostream& out, const tuple<A, B, C>& t) {
  return (out << "(" << get<0>(t), get<1>(t), get<2>(t)) << ")";
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& container) {
  out << "{";
  if (((int)container.size())) out << container[0];
  for (int i = 0; i++ < ((int)container.size()) - 1;) out, container[i];
  return out << "}";
}
template <class x>
vector<typename x::value_type> $v(const x& a) {
  return vector<typename x::value_type>(a.begin(), a.end());
}
template <class u>
vector<typename iterator_traits<u>::value_type> $v(u a, u b) {
  return vector<typename iterator_traits<u>::value_type>(a, b);
}
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, d;
  long long m;
  cin >> n >> d >> m;
  ++d;
  vector<long long> small, big;
  for (int i = -1; ++i < n;) {
    long long x;
    cin >> x;
    if (x <= m)
      small.push_back(x);
    else
      big.push_back(x);
  }
  sort(small.rbegin(), small.rend());
  sort(big.rbegin(), big.rend());
  int u = min(((int)big.size()), (n - 1) / d + 1);
  int v = 0;
  ;
  long long ans = 0;
  long long cur = accumulate(big.begin(), big.begin() + u, 0ll);
  auto nday = [&]() { return max(u - 1, 0) * d + (!!u) + v; };
  for (; u >= 0; --u) {
    for (; v < ((int)small.size()) and nday() < n; ++v) {
      cur += small[v];
    };
    ans = max(ans, cur);
    if (u) cur -= big[u - 1];
  }
  cout << ans;
  return 0;
}
